Re: pgcrypto/px.c fix

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Marko Kreen <marko(at)l-t(dot)ee>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: pgcrypto/px.c fix
Date: 2001-09-06 03:21:38
Message-ID: 200109060321.f863LcD06387@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Patch applied. Thanks.

>
> This makes encrypt() parser more strict.
>
> --
> marko
>
>
> Index: contrib/pgcrypto/px.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/px.c,v
> retrieving revision 1.1
> diff -u -r1.1 px.c
> --- contrib/pgcrypto/px.c 21 Aug 2001 01:32:01 -0000 1.1
> +++ contrib/pgcrypto/px.c 21 Aug 2001 12:11:15 -0000
> @@ -208,7 +208,7 @@
>
> /* PARSER */
>
> -static void
> +static int
> parse_cipher_name(char *full, char **cipher, char **pad)
> {
> char *p, *p2, *q;
> @@ -229,14 +229,16 @@
> p2 = strchr(p, ':');
> if (p2 != NULL) {
> *p2++ = 0;
> - if (!strcmp(p, "pad")) {
> + if (!strcmp(p, "pad"))
> *pad = p2;
> - } else {
> - elog(ERROR, "Unknown component: '%s'", p);
> - }
> - }
> + else
> + return -1;
> + } else
> + return -1;
> +
> p = q;
> }
> + return 0;
> }
>
> /* provider */
> @@ -255,11 +257,11 @@
> buf = px_alloc(strlen(name) + 1);
> strcpy(buf, name);
>
> - parse_cipher_name(buf, &s_cipher, &s_pad);
> - if (s_cipher == NULL) {
> + err = parse_cipher_name(buf, &s_cipher, &s_pad);
> + if (err) {
> px_free(buf);
> px_free(cx);
> - return -1;
> + return err;
> }
>
> err = px_find_cipher(s_cipher, &cx->cipher);
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-09-06 03:22:38 Re: to_char(interval)
Previous Message Bruce Momjian 2001-09-06 03:20:28 Re: [PATCHES] Patch for broken JDBC's getColumn()