com php-src: Fix: A buf == NULL on filehandle will segfault: sapi/phpdbg/phpdbg_list.c
| From: | Bob Weinand | Date: | Mon, 27 Jul 2015 14:57:09 +0000 |
| Subject: | com php-src: Fix: A buf == NULL on filehandle will segfault: sapi/phpdbg/phpdbg_list.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88183@lists.php.net to get a copy of this message | ||
Commit: 248ebf0df69f61f5538df44d3565893935b784c5
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 27 Jul 2015 16:56:54 +0200
Parents: 11613a1b58a5a890ddc99d81cefc6fdced8f1af8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=248ebf0df69f61f5538df44d3565893935b784c5
Log:
Fix: A buf == NULL on filehandle will segfault
Changed paths:
M sapi/phpdbg/phpdbg_list.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 3d64c8b..89e352a 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -244,12 +244,11 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
return NULL;
}
- data.buf = NULL;
+ data.buf = emalloc(data.len + 1);
if (data.len > 0) {
- data.buf = emalloc(data.len + 1);
memcpy(data.buf, bufptr, data.len);
- data.buf[data.len] = 0;
}
+ data.buf[data.len] = 0;
data.filename = filename;
data.line[0] = 0;