]> 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 a8cb02f8cf47081a3cc0d2b84c600c2476098261..df188a10e37a0c7b861ff7ddb6791cbb7eb121e6 100644 (file)
@@ -1713,7 +1713,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);