From: Slaven Rezic Date: Fri, 31 Oct 2003 12:16:11 +0000 (+0000) Subject: Off-by-one error in regcomp.c X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=197cf9b9fa28c8b3d5afcefd42f8263ea63819b3;p=p5sagit%2Fp5-mst-13.2.git Off-by-one error in regcomp.c Message-Id: <1067602571.12768@devpc01.iconmobile.de> p4raw-id: //depot/perl@21591 --- diff --git a/regcomp.c b/regcomp.c index ded3c63..6293ade 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5045,7 +5045,7 @@ S_re_croak2(pTHX_ const char* pat1,const char* pat2,...) if (l1 > 512) l1 = 512; Copy(message, buf, l1 , char); - buf[l1] = '\0'; /* Overwrite \n */ + buf[l1-1] = '\0'; /* Overwrite \n */ Perl_croak(aTHX_ "%s", buf); } diff --git a/t/op/regmesg.t b/t/op/regmesg.t index 8241941..05688b4 100644 --- a/t/op/regmesg.t +++ b/t/op/regmesg.t @@ -131,6 +131,7 @@ while (@death) chomp $@; $result =~ s/{\#}/$marker1/; $result =~ s/{\#}/$marker2/; + $result .= " at "; if ($@ !~ /^\Q$result/) { print "# For $regex, expected:\n# $result\n# Got:\n# $@\n#\nnot "; } @@ -164,6 +165,7 @@ while (@warning) } $result =~ s/{\#}/$marker1/; $result =~ s/{\#}/$marker2/; + $result .= " at "; if ($warning !~ /^\Q$result/) { print <<"EOM";