summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_list.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-07-25 20:05:58 +0200
committerAnatol Belski <ab@php.net>2015-07-26 20:54:26 +0200
commitc18f5e1edddf68bd449cb2b8e55d47a7da622cde (patch)
tree79daec20cfbe3eb1d84dae634f0e18c87191ad37 /sapi/phpdbg/phpdbg_list.c
parentd73287be18a35c1541f6f856156d30ed171a318b (diff)
downloadphp-git-c18f5e1edddf68bd449cb2b8e55d47a7da622cde.tar.gz
add NULL check
Diffstat (limited to 'sapi/phpdbg/phpdbg_list.c')
-rw-r--r--sapi/phpdbg/phpdbg_list.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index e577333837..3d64c8b077 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -244,9 +244,12 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
return NULL;
}
- data.buf = emalloc(data.len + 1);
- memcpy(data.buf, bufptr, data.len);
- data.buf[data.len] = 0;
+ data.buf = NULL;
+ if (data.len > 0) {
+ data.buf = emalloc(data.len + 1);
+ memcpy(data.buf, bufptr, data.len);
+ data.buf[data.len] = 0;
+ }
data.filename = filename;
data.line[0] = 0;