diff options
author | Marcus Boerger <helly@php.net> | 2007-02-24 02:17:47 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2007-02-24 02:17:47 +0000 |
commit | 50ea26760da4e0fcf4980e739e1d0ed520de8d59 (patch) | |
tree | 888a32ce58864f5318a7f1072f8526c6a99212f9 /Zend/zend_compile.c | |
parent | 3e262bd36989898ac01224f0a987e79f44d25b31 (diff) | |
download | php-git-50ea26760da4e0fcf4980e739e1d0ed520de8d59.tar.gz |
- Avoid sprintf, even when checked copy'n'paste or changes lead to errors
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d0b0b70b67..8f21d5f250 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -25,6 +25,7 @@ #include "zend_constants.h" #include "zend_llist.h" #include "zend_API.h" +#include "zend_exceptions.h" #ifdef ZEND_MULTIBYTE #include "zend_multibyte.h" @@ -83,14 +84,13 @@ static void build_runtime_defined_function_key(zval *result, char *name, int nam /* NULL, name length, filename length, last accepting char position length */ result->value.str.len = 1+name_length+strlen(filename)+char_pos_len; - result->value.str.val = (char *) emalloc(result->value.str.len+1); #ifdef ZEND_MULTIBYTE /* must be binary safe */ + result->value.str.val = (char *) safe_emalloc(result->value.str.len, 1, 1); result->value.str.val[0] = '\0'; - memcpy(result->value.str.val+1, name, name_length); - sprintf(result->value.str.val+1+name_length, "%s%s", filename, char_pos_buf); + sprintf(result->value.str.val+1, "%s%s%s", name, filename, char_pos_buf); #else - sprintf(result->value.str.val, "%c%s%s%s", '\0', name, filename, char_pos_buf); + zend_spprintf(&result->value.str.val, 0, "%c%s%s%s", '\0', name, filename, char_pos_buf); #endif /* ZEND_MULTIBYTE */ result->type = IS_STRING; result->refcount = 1; |