From: Felix Fietkau Date: Wed, 30 Jan 2008 19:16:28 +0000 (+0100) Subject: accept unnamed sections X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4094cedb83a0b92a179af13d1781a8fd7d3d943e;p=oweals%2Fuci.git accept unnamed sections --- diff --git a/file.c b/file.c index 980189f..4cb18d2 100644 --- a/file.c +++ b/file.c @@ -244,11 +244,16 @@ static char *next_arg(struct uci_context *ctx, char **str, bool required, bool n val = ptr = *str; skip_whitespace(ctx, str); parse_str(ctx, str, &ptr); - if (required && !*val) - uci_parse_error(ctx, *str, "insufficient arguments"); + if (!*val) { + if (required) + uci_parse_error(ctx, *str, "insufficient arguments"); + goto done; + } + if (name && !uci_validate_name(val)) uci_parse_error(ctx, val, "invalid character in field"); +done: return val; }