diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-11-13 19:07:09 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-11-13 19:07:09 +0100 |
commit | 37555a72adecf94648131869556fee88f171a85e (patch) | |
tree | 2de33b25d719918413437673efbf3cbbfb64cbb0 | |
parent | a35dcc95dd24524931ea1c7900ae466ce7c2c255 (diff) | |
download | perl-37555a72adecf94648131869556fee88f171a85e.tar.gz |
In Perl_lex_start(), don't read the byte before SvPVX().
If len is 0, we shouldn't be reading from len - 1, as it's one before the
start of the buffer, and hence an out of bounds read.
Fixes a bug inadvertently added by commit 0abcdfa4c5da571f, restoring the
previous behaviour for the len == 0 case.
-rw-r--r-- | toke.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -728,7 +728,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags) parser->linestr = flags & LEX_START_COPIED ? SvREFCNT_inc_simple_NN(line) : newSVpvn_flags(s, len, SvUTF8(line)); - if (s[len-1] != ';') + if (!len || s[len-1] != ';') sv_catpvs(parser->linestr, "\n;"); } else { parser->linestr = newSVpvs("\n;"); |