projects
/
carl9170fw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kconfig: Don't leak choice names during parsing
[carl9170fw.git]
/
config
/
zconf.y
diff --git
a/config/zconf.y
b/config/zconf.y
index 4dad8e5c620b1012e089f5486e491661a27fdcaf..c292f27d41d883a707b533bc9c7e5556e81cd8d2 100644
(file)
--- a/
config/zconf.y
+++ b/
config/zconf.y
@@
-20,10
+20,10
@@
int cdebug = PRINTD;
int cdebug = PRINTD;
-extern int zconflex(void);
+int yylex(void);
+static void yyerror(const char *err);
static void zconfprint(const char *err, ...);
static void zconf_error(const char *err, ...);
static void zconfprint(const char *err, ...);
static void zconf_error(const char *err, ...);
-static void zconferror(const char *err);
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
struct symbol *symbol_hash[SYMBOL_HASHSIZE];
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
struct symbol *symbol_hash[SYMBOL_HASHSIZE];
@@
-127,7
+127,7
@@
no_mainmenu_stmt: /* empty */
* later regardless of whether it comes from the 'prompt' in
* mainmenu_stmt or here
*/
* later regardless of whether it comes from the 'prompt' in
* mainmenu_stmt or here
*/
- menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL);
+ menu_add_prompt(P_MENU,
x
strdup("Linux Kernel Configuration"), NULL);
};
};
@@
-276,6
+276,7
@@
choice: T_CHOICE word_opt T_EOL
sym->flags |= SYMBOL_AUTO;
menu_add_entry(sym);
menu_add_expr(P_CHOICE, NULL, NULL);
sym->flags |= SYMBOL_AUTO;
menu_add_entry(sym);
menu_add_expr(P_CHOICE, NULL, NULL);
+ free($2);
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
};
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
};
@@
-436,6
+437,12
@@
help: help_start T_HELPTEXT
zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
current_entry->sym->name ?: "<choice>");
}
zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
current_entry->sym->name ?: "<choice>");
}
+
+ /* Is the help text empty or all whitespace? */
+ if ($2[strspn($2, " \f\n\r\t\v")] == '\0')
+ zconfprint("warning: '%s' defined with blank help text",
+ current_entry->sym->name ?: "<choice>");
+
current_entry->help = $2;
};
current_entry->help = $2;
};
@@
-532,9
+539,9
@@
void conf_parse(const char *name)
rootmenu.prompt = menu_add_prompt(P_MENU, "CARL9170 Firmware Configuration", NULL);
if (getenv("ZCONF_DEBUG"))
rootmenu.prompt = menu_add_prompt(P_MENU, "CARL9170 Firmware Configuration", NULL);
if (getenv("ZCONF_DEBUG"))
-
zconf
debug = 1;
-
zconf
parse();
- if (
zconf
nerrs)
+
yy
debug = 1;
+
yy
parse();
+ if (
yy
nerrs)
exit(1);
if (!modules_sym)
modules_sym = sym_find( "n" );
exit(1);
if (!modules_sym)
modules_sym = sym_find( "n" );
@@
-547,9
+554,9
@@
void conf_parse(const char *name)
menu_finalize(&rootmenu);
for_all_symbols(i, sym) {
if (sym_check_deps(sym))
menu_finalize(&rootmenu);
for_all_symbols(i, sym) {
if (sym_check_deps(sym))
-
zconf
nerrs++;
+
yy
nerrs++;
}
}
- if (
zconf
nerrs)
+ if (
yy
nerrs)
exit(1);
sym_set_change_count(1);
}
exit(1);
sym_set_change_count(1);
}
@@
-574,7
+581,7
@@
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok
if (id->token != endtoken) {
zconf_error("unexpected '%s' within %s block",
id->name, zconf_tokenname(starttoken));
if (id->token != endtoken) {
zconf_error("unexpected '%s' within %s block",
id->name, zconf_tokenname(starttoken));
-
zconf
nerrs++;
+
yy
nerrs++;
return false;
}
if (current_menu->file != current_file) {
return false;
}
if (current_menu->file != current_file) {
@@
-583,7
+590,7
@@
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok
fprintf(stderr, "%s:%d: location of the '%s'\n",
current_menu->file->name, current_menu->lineno,
zconf_tokenname(starttoken));
fprintf(stderr, "%s:%d: location of the '%s'\n",
current_menu->file->name, current_menu->lineno,
zconf_tokenname(starttoken));
-
zconf
nerrs++;
+
yy
nerrs++;
return false;
}
return true;
return false;
}
return true;
@@
-604,7
+611,7
@@
static void zconf_error(const char *err, ...)
{
va_list ap;
{
va_list ap;
-
zconf
nerrs++;
+
yy
nerrs++;
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
va_start(ap, err);
vfprintf(stderr, err, ap);
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
va_start(ap, err);
vfprintf(stderr, err, ap);
@@
-612,7
+619,7
@@
static void zconf_error(const char *err, ...)
fprintf(stderr, "\n");
}
fprintf(stderr, "\n");
}
-static void
zconf
error(const char *err)
+static void
yy
error(const char *err)
{
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
}
{
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
}