diff options
author | Zeev Suraski <zeev@php.net> | 2005-04-07 13:59:45 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2005-04-07 13:59:45 +0000 |
commit | 779f5c5c195037347699d7f352d16063adb80a8c (patch) | |
tree | 8769db0c765ba9b579b12d18c29ab1b976c03306 /Zend/zend_alloc.c | |
parent | cd47b3c54286e312f5f14437fe65411e100d4328 (diff) | |
download | php-git-779f5c5c195037347699d7f352d16063adb80a8c.tar.gz |
Fix strdup() bug when USE_ZEND_ALLOC is disabled
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r-- | Zend/zend_alloc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 78a0a18542..79041ed263 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -409,6 +409,15 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) return p; } +#if !USE_ZEND_ALLOC +char *_strndup(char *s, uint l) +{ + char *tmp = malloc(l+1); + tmp[l] = '\0'; + memcpy(tmp, s, l); + return tmp; +} +#endif ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { |