]> granicus.if.org Git - php/commitdiff
Use snprintf to make the static analyzers happy
authorPierrick Charron <pierrick@php.net>
Mon, 8 Aug 2011 11:19:49 +0000 (11:19 +0000)
committerPierrick Charron <pierrick@php.net>
Mon, 8 Aug 2011 11:19:49 +0000 (11:19 +0000)
Zend/zend_builtin_functions.c

index ce972a3ba8c448680c560cab36f1191b71eb3283..d507b6f5fe164b7e17b03359c7aae4619059a3b2 100644 (file)
@@ -1821,7 +1821,7 @@ ZEND_FUNCTION(create_function)
                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);