From: Pierrick Charron Date: Mon, 8 Aug 2011 03:08:59 +0000 (+0000) Subject: Use snprintf and strncat to make the static analyzers happy X-Git-Tag: php-5.4.0beta1~482 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed7b3e703e7807e2c9e2d30bda26e530e93e0f45;p=php Use snprintf and strncat to make the static analyzers happy --- diff --git a/Zend/zend.c b/Zend/zend.c index 6b6b9c2af0..7e2917c5a7 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -870,7 +870,7 @@ void zend_append_version_info(const zend_extension *extension) /* {{{ */ char *new_info; uint new_info_length; - new_info_length = sizeof(" with v, by \n") + new_info_length = sizeof(" with v, , by \n") + strlen(extension->name) + strlen(extension->version) + strlen(extension->copyright) @@ -878,10 +878,10 @@ void zend_append_version_info(const zend_extension *extension) /* {{{ */ new_info = (char *) malloc(new_info_length + 1); - sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author); + snprintf(new_info, new_info_length, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author); zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length + 1); - strcat(zend_version_info, new_info); + strncat(zend_version_info, new_info, new_info_length); zend_version_info_length += new_info_length; free(new_info); }