From: | Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | reading uninitialized buffer |
Date: | 2004-02-01 07:52:11 |
Message-ID: | Pine.LNX.4.44.0402010842270.30205-200000@zigo.dhs.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
pgsql_read_uninitialized_buffer.patch | text/plain | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nicolai Tufar | 2004-02-01 09:29:53 | C locale sort in src/tools/make_ctags |
Previous Message | Tom Lane | 2004-02-01 05:00:26 | Re: pg_generate_sequence and info_schema patch (Was: SELECT Question) |