diff options
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r-- | scripts/kconfig/confdata.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index f88d90f202..2f778df206 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -155,18 +155,14 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) case S_STRING: if (*p++ != '"') break; - for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { - if (*p2 == '"') { - *p2 = 0; - break; - } - memmove(p2, p2 + 1, strlen(p2)); - } - if (!p2) { + /* Last char has to be a '"' */ + if (p[strlen(p) - 1] != '"') { if (def != S_DEF_AUTO) conf_warning("invalid string found"); return 1; } + /* Overwrite '"' with \0 for string termination */ + p[strlen(p) - 1] = 0; /* fall through */ case S_INT: case S_HEX: @@ -624,6 +620,7 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym, struct conf_printer *printer, void *printer_arg) { const char *str; + char *str2; switch (sym->type) { case S_OTHER: @@ -631,9 +628,10 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym, break; case S_STRING: str = sym_get_string_value(sym); - str = sym_escape_string_value(str); - printer->print_symbol(fp, sym, str, printer_arg); - free((void *)str); + str2 = xmalloc(strlen(str) + 3); + sprintf(str2, "\"%s\"", str); + printer->print_symbol(fp, sym, str2, printer_arg); + free((void *)str2); break; default: str = sym_get_string_value(sym); |