Re: small fix to possible null pointer dereference in byteaout() varlena.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: small fix to possible null pointer dereference in byteaout() varlena.c
Дата
Msg-id 24913.1285687415@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: small fix to possible null pointer dereference in byteaout() varlena.c  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-hackers
Grzegorz Jaśkiewicz <gryzman@gmail.com> writes:
> ...
>                 rp = result = NULL;             /* keep compiler quiet */
>         }
>         *rp = '\0';
> ....

> this strikes me as a clear case of possible null pointer dereference,
> wouldn't you agree ?

No, I wouldn't.  You need to enlarge your peephole by one line:
   else   {       elog(ERROR, "unrecognized bytea_output setting: %d",            bytea_output);       rp = result =
NULL;       /* keep compiler quiet */   }   *rp = '\0';
 

The "keep compiler quiet" line is unreachable code (and that comment is
supposed to remind you of that).
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: security label support, revised
Следующее
От: Robert Haas
Дата:
Сообщение: Re: small fix to possible null pointer dereference in byteaout() varlena.c