Buffer overflow in contrib/test_parser/test_parser.c

Started by Paul Guyotover 14 years ago2 messageshackers
Jump to latest
#1Paul Guyot
pguyot@kallisys.net

Hello,

There is a buffer overflow in sample code's test_parser.c that can yield to a segmentation fault. The next byte of the buffer is tested against ' ' before its availability is checked.

You will find attached a simple patch that fixes the bug.

Paul
-- 
Semiocast            http://semiocast.com/
+33.183627948 - 20 rue Lacaze, 75014 Paris

Attachments:

test_parser.c.diffapplication/octet-stream; name=test_parser.c.diffDownload+4-4
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Paul Guyot (#1)
Re: Buffer overflow in contrib/test_parser/test_parser.c

Paul Guyot <pguyot@kallisys.net> writes:

There is a buffer overflow in sample code's test_parser.c that can yield to a segmentation fault. The next byte of the buffer is tested against ' ' before its availability is checked.

Hmm, yeah. The probability of a failure is very low of course, but
still it'd be better if the sample code didn't have bugs like this.

You will find attached a simple patch that fixes the bug.

Will apply, thank you.

regards, tom lane