Purify: Array bounds read: could read one character past the end.
Jarkko Hietaniemi [Sat, 23 Mar 2002 01:40:53 +0000 (01:40 +0000)]
p4raw-id: //depot/perl@15438

pp_pack.c

index b653362..7df5f45 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1525,8 +1525,9 @@ Perl_unpack_str(pTHX_ char *pat, register char *patend, register char *s, char *
                }
                if (*s == '\n')
                    s++;
-               else if (s[1] == '\n')          /* possible checksum byte */
-                   s += 2;
+               else    /* possible checksum byte */
+                   if (s + 1 < strend && s[1] == '\n')
+                       s += 2;
            }
            XPUSHs(sv_2mortal(sv));
            break;