com php-src: Fix issue krakjoe/phpdbg#122 (segfault in helpaliases): phpdbg_help.c phpdbg_utils.c
| From: | Bob Weinand | Date: | Fri, 10 Oct 2014 22:20:30 +0000 |
| Subject: | com php-src: Fix issue krakjoe/phpdbg#122 (segfault in helpaliases): phpdbg_help.c phpdbg_utils.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82569@lists.php.net to get a copy of this message | ||
Commit: 3445e0e59ed8d3852664532f345e924f7100a54a
Author: Bob Weinand <bobwei9@hotmail.com> Sat, 11 Oct 2014 00:20:30 +0200
Parents: 9dfc5d551143c41b32d98aa68219ec075a9b4bd2
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3445e0e59ed8d3852664532f345e924f7100a54a
Log:
Fix issue krakjoe/phpdbg#122 (segfault in helpaliases)
Bugs:
https://bugs.php.net/122
Changed paths:
M phpdbg_help.c
M phpdbg_utils.c
Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 3adc38b..29087e0 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -265,10 +265,10 @@ PHPDBG_HELP(aliases) /* {{{ */
/* Print out aliases for all commands except help as this one comes last */
phpdbg_writeln("help", "", "Below are the aliased, short versions of all
supported commands");
- phpdbg_xml("<helpcommands>");
+ phpdbg_xml("<helpcommands %r>");
for(c = phpdbg_prompt_commands; c->name; c++) {
if (c->alias && c->alias != 'h') {
- phpdbg_writeln("command", "name=\"%s\" alias=\"%c\"
tip=\"%s\"", " %c %-20s %s", c->alias, c->name, c->tip);
+ phpdbg_writeln("command", "alias=\"%c\" name=\"%s\"
tip=\"%s\"", " %c %-20s %s", c->alias, c->name, c->tip);
if (c->subs) {
len = 20 - 1 - c->name_len;
for(c_sub = c->subs; c_sub->alias; c_sub++) {
@@ -285,7 +285,7 @@ PHPDBG_HELP(aliases) /* {{{ */
/* Print out aliases for help as this one comes last, with the added text on how aliases are used
*/
get_command("h", 1, &c, phpdbg_prompt_commands TSRMLS_CC);
- phpdbg_writeln("aliasinfo", "alias=\"%c\" name=\"%-*s\"
tip=\"%s\"", " %c %-20s %s\n", c->alias, c->name, c->tip);
+ phpdbg_writeln("aliasinfo", "alias=\"%c\" name=\"%s\"
tip=\"%s\"", " %c %-20s %s\n", c->alias, c->name, c->tip);
phpdbg_xml("<helpaliases>");
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index 11e3a52..c631d8f5 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -772,8 +772,8 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
s_len = precision;
}
} else {
- s = S_NULL;
- s_len = S_NULL_LEN;
+ s = "";
+ s_len = 0;
}
pad_char = ' ';
break;
@@ -1279,6 +1279,8 @@ PHPDBG_API int phpdbg_vprint(int type TSRMLS_DC, int fd, const char *tag,
const
va_copy(argcpy, args);
xmllen = phpdbg_xml_vasprintf(&xml, xmlfmt, 1, argcpy TSRMLS_CC);
va_end(argcpy);
+ } else {
+ xml = estrdup("");
}
}