Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a67cb1319f53fa68012a23d6ca45279c6bc627f8
Commit:     a67cb1319f53fa68012a23d6ca45279c6bc627f8
Parent:     48874077ddd6c0c444758059af2cf77c10204ece
Author:     Sam Ravnborg <[EMAIL PROTECTED]>
AuthorDate: Wed Sep 19 21:23:09 2007 +0200
Committer:  Sam Ravnborg <[EMAIL PROTECTED](none)>
CommitDate: Fri Oct 12 21:15:32 2007 +0200

    kconfig: fix segv fault in menuconfig
    
    With specific configurations requesting help for certain
    menu lines caused menuconfig to crash.
    This was tracked down to a null pointer bug.
    Thanks to "Miles Lane" <[EMAIL PROTECTED]> for inital reporting
    and to Gabriel C <[EMAIL PROTECTED]> for the backtrace
    that helped me locating the bug.
    
    Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]>
---
 scripts/kconfig/mconf.c |    5 +++--
 scripts/kconfig/util.c  |   13 ++++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 2ee12a7..1935818 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -357,8 +357,9 @@ static void get_symbol_str(struct gstr *r, struct symbol 
*sym)
        bool hit;
        struct property *prop;
 
-       str_printf(r, "Symbol: %s [=%s]\n", sym->name,
-                                      sym_get_string_value(sym));
+       if (sym && sym->name)
+               str_printf(r, "Symbol: %s [=%s]\n", sym->name,
+                                                   sym_get_string_value(sym));
        for_all_prompts(sym, prop)
                get_prompt_str(r, prop);
        hit = false;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index e3f28b9..e1cad92 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -84,12 +84,15 @@ void str_free(struct gstr *gs)
 /* Append to growable string */
 void str_append(struct gstr *gs, const char *s)
 {
-       size_t l = strlen(gs->s) + strlen(s) + 1;
-       if (l > gs->len) {
-               gs->s   = realloc(gs->s, l);
-               gs->len = l;
+       size_t l;
+       if (s) {
+               l = strlen(gs->s) + strlen(s) + 1;
+               if (l > gs->len) {
+                       gs->s   = realloc(gs->s, l);
+                       gs->len = l;
+               }
+               strcat(gs->s, s);
        }
-       strcat(gs->s, s);
 }
 
 /* Append printf formatted string to growable string */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to