summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_list.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-07-27 16:56:54 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-07-27 16:57:09 +0200
commit248ebf0df69f61f5538df44d3565893935b784c5 (patch)
tree1c1c36e8304110f10350329d854d3c06aa540a2b /sapi/phpdbg/phpdbg_list.c
parent11613a1b58a5a890ddc99d81cefc6fdced8f1af8 (diff)
downloadphp-git-248ebf0df69f61f5538df44d3565893935b784c5.tar.gz
Fix: A buf == NULL on filehandle will segfault
Diffstat (limited to 'sapi/phpdbg/phpdbg_list.c')
-rw-r--r--sapi/phpdbg/phpdbg_list.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 3d64c8b077..89e352a971 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;