summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2008-05-30 21:41:05 +0000
committerDave Mitchell <davem@fdisolutions.com>2008-05-30 21:41:05 +0000
commit8ba22ff48d546c5622ef74aee96415810fcbf7a0 (patch)
tree645245e71b86a0d2b86af852cda34e5dba003fc1 /util.c
parent10489e41959ba56eedd511a8c320dfec04d8f588 (diff)
downloadperl-8ba22ff48d546c5622ef74aee96415810fcbf7a0.tar.gz
[perl #53746] bug with index() matching beyond end of string
An off-by-one error meant that index($str,...) was effectively being executed as index("$str\0", ...). Probably introduced by change #26511. p4raw-link: @26511 on //depot/perl: 4c8626beeba549aaf3f327729c56a599716ee8b7 p4raw-id: //depot/perl@33952
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index a6b5c1c226..b59959c6dc 100644
--- a/util.c
+++ b/util.c
@@ -440,9 +440,9 @@ Perl_ninstr(pTHX_ const char *big, const char *bigend, const char *little, const
if (little >= lend)
return (char*)big;
{
- const char first = *little++;
+ const char first = *little;
const char *s, *x;
- bigend -= lend - little;
+ bigend -= lend - little++;
OUTER:
while (big <= bigend) {
if (*big++ == first) {