com php-src: add NULL check: sapi/phpdbg/phpdbg_list.c
| From: | Anatol Belski | Date: | Sun, 26 Jul 2015 18:54:26 +0000 |
| Subject: | com php-src: add NULL check: sapi/phpdbg/phpdbg_list.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88164@lists.php.net to get a copy of this message | ||
Commit: c18f5e1edddf68bd449cb2b8e55d47a7da622cde
Author: Anatol Belski <ab@php.net> Sat, 25 Jul 2015 20:05:58 +0200
Parents: d73287be18a35c1541f6f856156d30ed171a318b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c18f5e1edddf68bd449cb2b8e55d47a7da622cde
Log:
add NULL check
Changed paths:
M sapi/phpdbg/phpdbg_list.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index e577333..3d64c8b 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;