]> granicus.if.org Git - postgresql/commit
Fix one-byte buffer overrun in contrib/test_parser.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 10 Jan 2012 00:56:27 +0000 (19:56 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 10 Jan 2012 00:57:46 +0000 (19:57 -0500)
commit23bd628b9fb912292496670d6dc42719a7fd1951
treebe40ec636ced79301306cd027af6bd80afaaf436
parenta2beb5b3d1d5848f85d78d8365be70bdb0337603
Fix one-byte buffer overrun in contrib/test_parser.

The original coding examined the next character before verifying that
there *is* a next character.  In the worst case with the input buffer
right up against the end of memory, this would result in a segfault.

Problem spotted by Paul Guyot; this commit extends his patch to fix an
additional case.  In addition, make the code a tad more readable by not
overloading the usage of *tlen.
contrib/test_parser/test_parser.c