summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@openbsd.org>2013-10-18 15:38:55 +0100
committerDavid Mitchell <davem@iabyn.com>2013-10-18 15:38:55 +0100
commita7ed8fa56423636ca5e455bcd62684a54672da57 (patch)
tree1c8e29554f6a941c3f814ac04ce65bc3c85c3774 /x2p
parent099bebb16fa63575ffc552487c463aac86763c70 (diff)
downloadperl-a7ed8fa56423636ca5e455bcd62684a54672da57.tar.gz
fix off-by one error in a2p
The str_gets() function, when encountering a newline character, checked to see if the previous char was a \ escape. For a blank line, the check would read the char at the position one before the start of the buffer. There was a test to avoid this, but it was off-by-one.
Diffstat (limited to 'x2p')
-rw-r--r--x2p/str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/x2p/str.c b/x2p/str.c
index 86127a0f3a..e12e5e9c12 100644
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -200,7 +200,7 @@ str_gets(STR *str, FILE *fp)
for (;;) {
while (--cnt >= 0) {
if ((*bp++ = *ptr++) == newline) {
- if (bp <= str->str_ptr || bp[-2] != '\\')
+ if (bp <= str->str_ptr + 1 || bp[-2] != '\\')
goto thats_all_folks;
else {
line++;