Fix one-byte buffer overrun in contrib/test_parser.
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.

jmcatamney/gpdb,kmjungersen/PostgresXL,arcivanov/postgres-xl,greenplum-db/gpdb,50wu/gpdb,kmjungersen/PostgresXL,jmcatamney/gpdb,50wu/gpdb,50wu/gpdb,tpostgres-projects/tPostgres,jmcatamney/gpdb,snaga/postgres-xl,Postgres-XL/Postgres-XL,adam8157/gpdb,greenplum-db/gpdb,tpostgres-projects/tPostgres,lisakowen/gpdb,arcivanov/postgres-xl,ashwinstar/gpdb,ovr/postgres-xl,yazun/postgres-xl,Postgres-XL/Postgres-XL,ashwinstar/gpdb,zeroae/postgres-xl,adam8157/gpdb,zeroae/postgres-xl,50wu/gpdb,jmcatamney/gpdb,postmind-net/postgres-xl,adam8157/gpdb,xinzweb/gpdb,snaga/postgres-xl,yazun/postgres-xl,zeroae/postgres-xl,kmjungersen/PostgresXL,kmjungersen/PostgresXL,greenplum-db/gpdb,oberstet/postgres-xl,arcivanov/postgres-xl,xinzweb/gpdb,snaga/postgres-xl,50wu/gpdb,postmind-net/postgres-xl,ashwinstar/gpdb,lisakowen/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,oberstet/postgres-xl,ovr/postgres-xl,oberstet/postgres-xl,arcivanov/postgres-xl,tpostgres-projects/tPostgres,ovr/postgres-xl,50wu/gpdb,xinzweb/gpdb,ashwinstar/gpdb,kmjungersen/PostgresXL,ashwinstar/gpdb,arcivanov/postgres-xl,yazun/postgres-xl,techdragon/Postgres-XL,snaga/postgres-xl,pavanvd/postgres-xl,xinzweb/gpdb,pavanvd/postgres-xl,adam8157/gpdb,tpostgres-projects/tPostgres,postmind-net/postgres-xl,techdragon/Postgres-XL,xinzweb/gpdb,lisakowen/gpdb,jmcatamney/gpdb,Postgres-XL/Postgres-XL,tpostgres-projects/tPostgres,lisakowen/gpdb,ovr/postgres-xl,techdragon/Postgres-XL,yazun/postgres-xl,oberstet/postgres-xl,adam8157/gpdb,jmcatamney/gpdb,ovr/postgres-xl,xinzweb/gpdb,oberstet/postgres-xl,adam8157/gpdb,postmind-net/postgres-xl,greenplum-db/gpdb,snaga/postgres-xl,ashwinstar/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,yazun/postgres-xl,Postgres-XL/Postgres-XL,zeroae/postgres-xl,jmcatamney/gpdb,arcivanov/postgres-xl,50wu/gpdb,zeroae/postgres-xl,greenplum-db/gpdb,greenplum-db/gpdb,lisakowen/gpdb,jmcatamney/gpdb,postmind-net/postgres-xl,50wu/gpdb,xinzweb/gpdb,pavanvd/postgres-xl,lisakowen/gpdb,greenplum-db/gpdb,adam8157/gpdb,adam8157/gpdb,xinzweb/gpdb,ashwinstar/gpdb,lisakowen/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL,pavanvd/postgres-xl,pavanvd/postgres-xl