Skip to content

Commit

Permalink
kconfig: fix segv fault in menuconfig
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sravnborg authored and Sam Ravnborg committed Oct 12, 2007
1 parent 4887407 commit a67cb13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 8 additions & 5 deletions scripts/kconfig/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit a67cb13

Please sign in to comment.