summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlaven Rezic <slaven@rezic.de>2003-10-31 12:16:11 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-10-31 19:54:23 +0000
commit197cf9b9fa28c8b3d5afcefd42f8263ea63819b3 (patch)
tree767c2c22c0a53037a11f552341978c73664626df
parenta12755f08356686e8eba9b8e518360528f66abdc (diff)
downloadperl-197cf9b9fa28c8b3d5afcefd42f8263ea63819b3.tar.gz
Off-by-one error in regcomp.c
Message-Id: <1067602571.12768@devpc01.iconmobile.de> p4raw-id: //depot/perl@21591
-rw-r--r--regcomp.c2
-rw-r--r--t/op/regmesg.t2
2 files changed, 3 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index ded3c633ae..6293ade0e2 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 8241941156..05688b4a96 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";