Fix: A buf == NULL on filehandle will segfault

This commit is contained in:
Bob Weinand 2015-07-27 16:56:54 +02:00
parent 11613a1b58
commit 248ebf0df6

View file

@ -244,12 +244,11 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
return NULL;
}
data.buf = NULL;
if (data.len > 0) {
data.buf = emalloc(data.len + 1);
if (data.len > 0) {
memcpy(data.buf, bufptr, data.len);
data.buf[data.len] = 0;
}
data.buf[data.len] = 0;
data.filename = filename;
data.line[0] = 0;