/* command string null-terminated by strtok */
*str += strlen(*str) + 1;
- type = next_arg(ctx, str, true, true);
+ type = next_arg(ctx, str, true, false);
+ if (!uci_validate_str(type, false))
+ uci_parse_error(ctx, type, "invalid character in field");
name = next_arg(ctx, str, false, true);
assert_eol(ctx, str);
*str += strlen(*str) + 1;
name = next_arg(ctx, str, true, true);
- value = next_arg(ctx, str, true, false);
+ value = next_arg(ctx, str, false, false);
assert_eol(ctx, str);
if (pctx->merge) {
/* make sure no memory from previous parse attempts is leaked */
uci_file_cleanup(ctx);
- pctx = (struct uci_parse_context *) uci_malloc(ctx, sizeof(struct uci_parse_context));
- ctx->pctx = pctx;
+ uci_alloc_parse_context(ctx);
+ pctx = ctx->pctx;
pctx->file = stream;
if (*package && single) {
pctx->package = *package;
/* freed together with the uci_package */
path = NULL;
- /* check for updated history, just in case */
+ /* check for updated history, flush */
uci_load_history(ctx, p, true);
} else {
/* flush history */