This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop csh_glob from reading past end of string
authorFather Chrysostomos <sprout@cpan.org>
Thu, 27 Oct 2011 21:31:13 +0000 (14:31 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 27 Oct 2011 21:32:53 +0000 (14:32 -0700)
It was reading one byte too far, and looking at the trailing null.
This happened only in the case of an unmatched quote.

ext/File-Glob/Glob.xs

index c055d1b..030e827 100644 (file)
@@ -132,7 +132,7 @@ csh_glob(pTHX)
                }
                if (piece) sv_catpvn(word, piece, s-piece);
                piece = s+1;
-               while (++s <= patend)
+               while (++s < patend)
                    if (*s == '\\') {
                        s++;
                        /* If the backslash is here to escape a quote,