laruence                                 Tue, 09 Aug 2011 09:35:42 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=314598

Log:
Avoiding strcpy usage, Make static analyzer happy

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c
    U   php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c
    U   php/php-src/trunk/ext/ereg/regex/regerror.c
    A   php/php-src/trunk/ext/ereg/regex.patch

Modified: php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c      2011-08-09 
09:34:32 UTC (rev 314597)
+++ php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c      2011-08-09 
09:35:42 UTC (rev 314598)
@@ -82,7 +82,7 @@

                if (errcode&REG_ITOA) {
                        if (r->code >= 0)
-                               (void) strcpy(convbuf, r->name);
+                               (void) strncpy(convbuf, r->name, 50);
                        else
                                sprintf(convbuf, "REG_0x%x", target);
                        assert(strlen(convbuf) < sizeof(convbuf));

Modified: php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c      2011-08-09 
09:34:32 UTC (rev 314597)
+++ php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c      2011-08-09 
09:35:42 UTC (rev 314598)
@@ -82,7 +82,7 @@

                if (errcode&REG_ITOA) {
                        if (r->code >= 0)
-                               (void) strcpy(convbuf, r->name);
+                               (void) strncpy(convbuf, r->name, 50);
                        else
                                sprintf(convbuf, "REG_0x%x", target);
                        assert(strlen(convbuf) < sizeof(convbuf));

Modified: php/php-src/trunk/ext/ereg/regex/regerror.c
===================================================================
--- php/php-src/trunk/ext/ereg/regex/regerror.c 2011-08-09 09:34:32 UTC (rev 
314597)
+++ php/php-src/trunk/ext/ereg/regex/regerror.c 2011-08-09 09:35:42 UTC (rev 
314598)
@@ -82,7 +82,7 @@

                if (errcode&REG_ITOA) {
                        if (r->code >= 0)
-                               (void) strcpy(convbuf, r->name);
+                               (void) strncpy(convbuf, r->name, 50);
                        else
                                sprintf(convbuf, "REG_0x%x", target);
                        assert(strlen(convbuf) < sizeof(convbuf));

Added: php/php-src/trunk/ext/ereg/regex.patch
===================================================================
--- php/php-src/trunk/ext/ereg/regex.patch                              (rev 0)
+++ php/php-src/trunk/ext/ereg/regex.patch      2011-08-09 09:35:42 UTC (rev 
314598)
@@ -0,0 +1,12 @@
+diff -u regex.orig/regerror.c regex/regerror.c
+--- regex.orig/regerror.c      2011-08-09 17:31:11.000000000 +0800
++++ regex/regerror.c   2011-08-09 17:29:53.000000000 +0800
+@@ -82,7 +82,7 @@
+
+               if (errcode&REG_ITOA) {
+                       if (r->code >= 0)
+-                              (void) strcpy(convbuf, r->name);
++                              (void) strncpy(convbuf, r->name, 50);
+                       else
+                               sprintf(convbuf, "REG_0x%x", target);
+                       assert(strlen(convbuf) < sizeof(convbuf));

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to