pierrick                                 Mon, 08 Aug 2011 11:19:49 +0000

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

Log:
Use snprintf to make the static analyzers happy

Changed paths:
    U   php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c
    U   php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c
    U   php/php-src/trunk/Zend/zend_builtin_functions.c

Modified: php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c  2011-08-08 
10:10:36 UTC (rev 314479)
+++ php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c  2011-08-08 
11:19:49 UTC (rev 314480)
@@ -1713,7 +1713,7 @@
                function_name[0] = '\0';

                do {
-                       function_name_length = 1 + sprintf(function_name + 1, 
"lambda_%d", ++EG(lambda_count));
+                       function_name_length = 1 + snprintf(function_name + 1, 
sizeof("0lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
                } while (zend_hash_add(EG(function_table), function_name, 
function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE);
                zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, 
sizeof(LAMBDA_TEMP_FUNCNAME));
                RETURN_STRINGL(function_name, function_name_length, 0);

Modified: php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c  2011-08-08 
10:10:36 UTC (rev 314479)
+++ php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c  2011-08-08 
11:19:49 UTC (rev 314480)
@@ -1821,7 +1821,7 @@
                function_name[0] = '\0';

                do {
-                       function_name_length = 1 + sprintf(function_name + 1, 
"lambda_%d", ++EG(lambda_count));
+                       function_name_length = 1 + snprintf(function_name + 1, 
sizeof("0lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
                } while (zend_hash_add(EG(function_table), function_name, 
function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE);
                zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, 
sizeof(LAMBDA_TEMP_FUNCNAME));
                RETURN_STRINGL(function_name, function_name_length, 0);

Modified: php/php-src/trunk/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/trunk/Zend/zend_builtin_functions.c     2011-08-08 10:10:36 UTC 
(rev 314479)
+++ php/php-src/trunk/Zend/zend_builtin_functions.c     2011-08-08 11:19:49 UTC 
(rev 314480)
@@ -1821,7 +1821,7 @@
                function_name[0] = '\0';

                do {
-                       function_name_length = 1 + sprintf(function_name + 1, 
"lambda_%d", ++EG(lambda_count));
+                       function_name_length = 1 + snprintf(function_name + 1, 
sizeof("0lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
                } while (zend_hash_add(EG(function_table), function_name, 
function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE);
                zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, 
sizeof(LAMBDA_TEMP_FUNCNAME));
                RETURN_STRINGL(function_name, function_name_length, 0);

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

Reply via email to