This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
genuine possible buffer problems spotted by flawfinder
authorNicholas Clark <nick@ccl4.org>
Sat, 20 Nov 2004 14:21:28 +0000 (14:21 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 20 Nov 2004 14:21:28 +0000 (14:21 +0000)
p4raw-id: //depot/perl@23520

regcomp.c
util.c

index 7b4d647..bcfb2a3 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5128,7 +5128,7 @@ Perl_save_re_context(pTHX)
        U32 i;
        GV *mgv;
        REGEXP *rx;
-       char digits[16];
+       char digits[TYPE_CHARS(long)];
 
        if (PL_curpm && (rx = PM_GETRE(PL_curpm))) {
            for (i = 1; i <= rx->nparens; i++) {
diff --git a/util.c b/util.c
index 9a90549..5a8ae3b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2539,7 +2539,7 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags)
     {
        SV *sv;
        SV** svp;
-       char spid[TYPE_CHARS(int)];
+       char spid[TYPE_CHARS(IV)];
 
        if (pid > 0) {
            sprintf(spid, "%"IVdf, (IV)pid);
@@ -2555,9 +2555,6 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags)
 
            hv_iterinit(PL_pidstatus);
            if ((entry = hv_iternext(PL_pidstatus))) {
-               SV *sv;
-               char spid[TYPE_CHARS(int)];
-
                pid = atoi(hv_iterkey(entry,(I32*)statusp));
                sv = hv_iterval(PL_pidstatus,entry);
                *statusp = SvIVX(sv);
@@ -2606,7 +2603,7 @@ void
 Perl_pidgone(pTHX_ Pid_t pid, int status)
 {
     register SV *sv;
-    char spid[TYPE_CHARS(int)];
+    char spid[TYPE_CHARS(IV)];
 
     sprintf(spid, "%"IVdf, (IV)pid);
     sv = *hv_fetch(PL_pidstatus,spid,strlen(spid),TRUE);