reading uninitialized buffer

Поиск
Список
Период
Сортировка
Искать
От
Dennis Bjorklund
Тема
reading uninitialized buffer
Дата
Msg-id
Pine.LNX.4.44.0402010842270.30205-200000@zigo.dhs.org
Список
Дерево обсуждения
reading uninitialized buffer Dennis Bjorklund <db@zigo.dhs.org>
Re: reading uninitialized buffer Andrew Dunstan <andrew@dunslane.net>
Re: reading uninitialized buffer Andrew Dunstan <andrew@dunslane.net>
Re: reading uninitialized buffer Tom Lane <tgl@sss.pgh.pa.us>
Re: reading uninitialized buffer Dennis Bjorklund <db@zigo.dhs.org>
Re: reading uninitialized buffer Andrew Dunstan <andrew@dunslane.net>
Re: reading uninitialized buffer Neil Conway <neilc@samurai.com>
Re: reading uninitialized buffer Neil Conway <neilc@samurai.com>
Re: reading uninitialized buffer Andrew Dunstan <andrew@dunslane.net>
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
Дата:
От: Nicolai Tufar
Дата:
FAQ