X-Git-Url: http://git.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=util.c;h=e1ef5858700ce4b109cd6a1e345048447212d398;hp=3358cdf22edf5e78eb3b271ec3c1e7395437f641;hb=714c75c47ac11770c2b638ad82631a57696c3a3c;hpb=8a06b55c63b13123ffcec33aff7f1fd752786dd1 diff --git a/util.c b/util.c index 3358cdf..e1ef585 100644 --- a/util.c +++ b/util.c @@ -107,6 +107,7 @@ static inline bool uci_validate_text(const char *str) if ((*str == '\r') || (*str == '\n') || ((*str < 32) && (*str != '\t'))) return false; + str++; } return true; } @@ -135,7 +136,8 @@ int uci_parse_tuple(struct uci_context *ctx, char *str, char **package, char **s *section = strsep(&str, "."); *option = NULL; - *value = NULL; + if (value) + *value = NULL; if (!*section) goto lastval; @@ -157,7 +159,7 @@ lastval: goto error; if (*option && !uci_validate_name(*option)) goto error; - if (*value && !uci_validate_text(*value)) + if (value && *value && !uci_validate_text(*value)) goto error; goto done;