]> 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:55 +0000 (19:57 -0500)
commit3852cfaf6065f14dd3dc4d2f59583de3c594d28b
tree1aaa2b49a953b0d667e7ced503b4c95684b20a1b
parentaa31c350fe01c4f5db571ea48b32869d97b70db4
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