]> granicus.if.org Git - php/commitdiff
Avoiding strcpy usage, Make static analyzer happy
authorXinchen Hui <laruence@php.net>
Tue, 9 Aug 2011 09:35:42 +0000 (09:35 +0000)
committerXinchen Hui <laruence@php.net>
Tue, 9 Aug 2011 09:35:42 +0000 (09:35 +0000)
ext/ereg/regex.patch [new file with mode: 0644]
ext/ereg/regex/regerror.c

diff --git a/ext/ereg/regex.patch b/ext/ereg/regex.patch
new file mode 100644 (file)
index 0000000..d10a9b9
--- /dev/null
@@ -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));
index 00009a93c15a5e59e278ebecb129a97ff8e3e445..f8c3ca3538f1374cf85832c6f9c7b14aae8eb009 100644 (file)
@@ -82,7 +82,7 @@ size_t errbuf_size)
        
                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));