This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp.c, regexec.c: Declare buffers large enough
authorKarl Williamson <public@khwilliamson.com>
Sat, 4 May 2013 19:29:15 +0000 (13:29 -0600)
committerKarl Williamson <public@khwilliamson.com>
Thu, 29 Aug 2013 15:56:08 +0000 (09:56 -0600)
These three buffers are not declared with the proper size.  There is
a #define available to use, so use it.  These matter only on EBCDIC
platforms, where the one in pp.c prior to this commit could cause a
buffer overrun there.

The others shouldn't because what is being used is known (smaller) size.

regcomp.c
regexec.c

index 694ff8b..8748f02 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -13489,7 +13489,7 @@ parseit:
                     /* If the folds haven't been read in, call a fold function
                      * to force that */
                     if (! PL_utf8_tofold) {
-                        U8 dummy[UTF8_MAXBYTES+1];
+                        U8 dummy[UTF8_MAXBYTES_CASE+1];
 
                         /* This string is just a short named one above \xff */
                         to_utf8_fold((U8*) HYPHEN_UTF8, dummy, NULL);
index b83272d..c2770dd 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3434,7 +3434,7 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const regnode * const text_node, int *c1p,
             SV** listp;
             if (! PL_utf8_foldclosures) {
                 if (! PL_utf8_tofold) {
-                    U8 dummy[UTF8_MAXBYTES+1];
+                    U8 dummy[UTF8_MAXBYTES_CASE+1];
 
                     /* Force loading this by folding an above-Latin1 char */
                     to_utf8_fold((U8*) HYPHEN_UTF8, dummy, NULL);