From b9bd2e23284af05e6bcba61eefcc45b5761a0407 Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Fri, 31 Oct 2003 12:16:11 +0000 Subject: [PATCH] Integrate: [ 21591] Subject: [PATCH] Off-by-one error in regcomp.c Message-Id: <1067602571.12768@devpc01.iconmobile.de> [ 21593] Test nit ; goes with change 21591 p4raw-link: @21593 on //depot/perl: d08083205cf0981a17df3d0fa9585ef663647309 p4raw-link: @21591 on //depot/perl: 197cf9b9fa28c8b3d5afcefd42f8263ea63819b3 p4raw-id: //depot/maint-5.8/perl@21606 p4raw-integrated: from //depot/perl@21605 'copy in' t/lib/warnings/regcomp (@15547..) t/op/regmesg.t (@15629..) 'merge in' regcomp.c (@21433..) --- regcomp.c | 2 +- t/lib/warnings/regcomp | 2 +- t/op/regmesg.t | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index e9ae5ab..e53dc0c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5037,7 +5037,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/lib/warnings/regcomp b/t/lib/warnings/regcomp index e9a8d70..4982016 100644 --- a/t/lib/warnings/regcomp +++ b/t/lib/warnings/regcomp @@ -78,7 +78,7 @@ no warnings 'regexp' ; /[.zog.]/; EXPECT POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5. -POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE / +POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5. ######## # regcomp.c [S_regclass] $_ = ""; 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"; -- 1.8.3.1