reading uninitialized buffer

Поиск
Список
Период
Сортировка
От Dennis Bjorklund
Тема reading uninitialized buffer
Дата
Msg-id Pine.LNX.4.44.0402010842270.30205-200000@zigo.dhs.org
обсуждение исходный текст
Ответы Re: reading uninitialized buffer  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-patches
I've been testing pg using valgrind and have found a read of an
uninitialized buffer. In the hba-tokenizer when we have not read any
characters (or too few) we still perform a couple of:

   strncmp(start_buf,"sameuser",8)

Since this is done on random data it might return true although we have
not read anything. The result is that we can (even if the probability is
low) return the wrong thing.

The solution is simply to terminate the buffer with '\0' before the
strncmp().

I also moved our test inside the previous if, outside of that block our
test can never be true anyway. I don't know why it was outside in the
first place.

--
/Dennis Björklund

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_generate_sequence and info_schema patch (Was: SELECT Question)
Следующее
От: "Nicolai Tufar"
Дата:
Сообщение: C locale sort in src/tools/make_ctags