Fix one-byte buffer overrun in contrib/test_parser.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: d427e75e51d9e7d76fc2a4bc142ba7be852a1078
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-01-10T00:57:21Z
Releases: 9.1.3
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.

Files

PathChange+/−
contrib/test_parser/test_parser.c modified +10 −9