]> granicus.if.org Git - php/commitdiff
Fix issue krakjoe/phpdbg#122 (segfault in helpaliases)
authorBob Weinand <bobwei9@hotmail.com>
Fri, 10 Oct 2014 22:20:30 +0000 (00:20 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Fri, 10 Oct 2014 22:20:30 +0000 (00:20 +0200)
phpdbg_help.c
phpdbg_utils.c

index 3adc38b6aeaae7efd75fa94ac1ac40f1a4b9d280..29087e005df156d6ef7e05ab9735c0c428a61284 100644 (file)
@@ -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>");
 
index 11e3a52a2373e2ba05dab87d8ea1d011a74eafeb..c631d8f52560e1ab27bb81f6f12bd85ea906a62e 100644 (file)
@@ -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("");
                }
        }