com php-src: Fix segfault in source command: phpdbg.c phpdbg_prompt.c
| From: | Bob Weinand | Date: | Mon, 25 Nov 2013 17:58:03 +0000 |
| Subject: | com php-src: Fix segfault in source command: phpdbg.c phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74602@lists.php.net to get a copy of this message | ||
Commit: be8adbb231f7c7a70c8b12d032c028dd8d954e8d
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 25 Nov 2013 18:58:03 +0100
Parents: 781bd90de338c2542594a859f00c893c7e1d6b89
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be8adbb231f7c7a70c8b12d032c028dd8d954e8d
Log:
Fix segfault in source command
Changed paths:
M phpdbg.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index d790f9d..ebe7caf 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -652,7 +652,7 @@ phpdbg_main:
case 'i': { /* set init file */
init_file_len = strlen(php_optarg);
if (init_file_len) {
- init_file = strdup(php_optarg);
+ init_file = estrdup(php_optarg);
}
} break;
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 84b1838..0e79e51 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -149,7 +149,7 @@ next_line:
}
if (free_init) {
- free(init_file);
+ efree(init_file);
}
}
} /* }}} */
@@ -176,7 +176,7 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TS
if (i != -1) {
scan_dir[i] = 0;
}
- init_file = malloc(strlen(scan_dir) + sizeof(PHPDBG_INIT_FILENAME));
+ init_file = emalloc(strlen(scan_dir) + sizeof(PHPDBG_INIT_FILENAME));
sprintf(init_file, "%s/%s", scan_dir, PHPDBG_INIT_FILENAME);
phpdbg_try_file_init(init_file, strlen(init_file), 1 TSRMLS_CC);
if (i == -1) {