diff options
author | Xinchen Hui <laruence@php.net> | 2011-08-09 09:35:42 +0000 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2011-08-09 09:35:42 +0000 |
commit | 571427c7db8bb67433f84d0ef75724a5f736a9fa (patch) | |
tree | 7c98834472c991a413d12b9a0711bdeee5502b5e /ext | |
parent | 7402dee0149e1a7d7a380619cb381e7f7c4cb02c (diff) | |
download | php-git-571427c7db8bb67433f84d0ef75724a5f736a9fa.tar.gz |
Avoiding strcpy usage, Make static analyzer happy
Diffstat (limited to 'ext')
-rw-r--r-- | ext/ereg/regex.patch | 12 | ||||
-rw-r--r-- | ext/ereg/regex/regerror.c | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/ext/ereg/regex.patch b/ext/ereg/regex.patch new file mode 100644 index 0000000000..d10a9b9a46 --- /dev/null +++ b/ext/ereg/regex.patch @@ -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®_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)); diff --git a/ext/ereg/regex/regerror.c b/ext/ereg/regex/regerror.c index 00009a93c1..f8c3ca3538 100644 --- a/ext/ereg/regex/regerror.c +++ b/ext/ereg/regex/regerror.c @@ -82,7 +82,7 @@ size_t errbuf_size) if (errcode®_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)); |