diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2005-06-06 23:25:20 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2005-06-06 23:25:20 +0000 |
commit | 8a4b1775346860f6af843ac62cd1c835b9372ba6 (patch) | |
tree | f35a91a5b098fedba5c07c314086ae526dc83ce2 /gnu | |
parent | b434530a1ce857ded172af85fc8008788345dc13 (diff) |
Add a missing check for NULL before dereferencing a buf pointer in
perl's yyerror(). Fixes a transient core dump on syntax error uncovered
by random malloc() return addresses. Sent upstream via perlbug.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/perl/toke.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gnu/usr.bin/perl/toke.c b/gnu/usr.bin/perl/toke.c index 07f7b8bb2c1..6f80abb5404 100644 --- a/gnu/usr.bin/perl/toke.c +++ b/gnu/usr.bin/perl/toke.c @@ -7755,8 +7755,9 @@ Perl_yyerror(pTHX_ char *s) if (!yychar || (yychar == ';' && !PL_rsfp)) where = "at EOF"; - else if (PL_bufptr > PL_oldoldbufptr && PL_bufptr - PL_oldoldbufptr < 200 && - PL_oldoldbufptr != PL_oldbufptr && PL_oldbufptr != PL_bufptr) { + else if (PL_oldoldbufptr && PL_bufptr > PL_oldoldbufptr && + PL_bufptr - PL_oldoldbufptr < 200 && PL_oldoldbufptr != PL_oldbufptr && + PL_oldbufptr != PL_bufptr) { /* Only for NetWare: The code below is removed for NetWare because it abends/crashes on NetWare @@ -7771,8 +7772,8 @@ Perl_yyerror(pTHX_ char *s) context = PL_oldoldbufptr; contlen = PL_bufptr - PL_oldoldbufptr; } - else if (PL_bufptr > PL_oldbufptr && PL_bufptr - PL_oldbufptr < 200 && - PL_oldbufptr != PL_bufptr) { + else if (PL_oldbufptr && PL_bufptr > PL_oldbufptr && + PL_bufptr - PL_oldbufptr < 200 && PL_oldbufptr != PL_bufptr) { /* Only for NetWare: The code below is removed for NetWare because it abends/crashes on NetWare |