com php-src: Fixed bug #70898 (SIGBUS/GPF zend_mm_alloc_s mall (zend_alloc.c:1291)): Zend/zend _API.c
| From: | Xinchen Hui | Date: | Thu, 12 Nov 2015 06:18:02 +0000 |
| Subject: | com php-src: Fixed bug #70898 (SIGBUS/GPF zend_mm_alloc_s mall (zend_alloc.c:1291)): Zend/zend _API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89762@lists.php.net to get a copy of this message | ||
Commit: e4e54f33ceb4ecce33397c867b45862af85c1fda
Author: Xinchen Hui <laruence@gmail.com> Thu, 12 Nov 2015 14:18:02 +0800
Parents: a1e8b74827c52979f0021c4616c4e2886353481c
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e4e54f33ceb4ecce33397c867b45862af85c1fda
Log:
Fixed bug #70898 (SIGBUS/GPF zend_mm_alloc_small (zend_alloc.c:1291))
Include tail \0
Bugs:
https://bugs.php.net/70898
Changed paths:
M Zend/zend_API.c
Diff:
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index c595a13..d06c503 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -243,7 +243,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, in
const char *class_name = get_active_class_name(&space);
size_t error_len = strlen(error), sanitized_error_len = error_len, k = 0, n = 0;
- char *sanitized_error = emalloc(sizeof(char) * error_len);
+ char *sanitized_error = emalloc(sizeof(char) * error_len + 1);
while (k < error_len) {
sanitized_error[n] = error[k];
@@ -256,7 +256,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, in
if (n == sanitized_error_len) {
sanitized_error_len += error_len - k;
- sanitized_error = erealloc(sanitized_error, sanitized_error_len);
+ sanitized_error = erealloc(sanitized_error, sanitized_error_len + 1);
}
}
sanitized_error[n] = '\0';