Skip to content

Commit

Permalink
Merge pull request #242 from openziti/fix-crash-on-bad-config-file
Browse files Browse the repository at this point in the history
avoid crash on parse error
  • Loading branch information
ekoby authored Feb 26, 2021
2 parents 84794f3 + ea69339 commit fb902d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions library/model_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ jsmntok_t* parse_tokens(jsmn_parser *parser, const char *json, size_t len, size_
*ntok = 0;
} else {
*ntok = rc;
}
if (*ntok == tok_cap) {
toks = realloc(toks, (tok_cap + 1) * sizeof(jsmntok_t));
}
toks[*ntok].type = JSMN_UNDEFINED;

if (*ntok == tok_cap) {
toks = realloc(toks, (tok_cap + 1) * sizeof(jsmntok_t));
}
toks[*ntok].type = JSMN_UNDEFINED;
}
return toks;
}

Expand Down
2 changes: 1 addition & 1 deletion library/ziti.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int ziti_init_opts(ziti_options *options, uv_loop_t *loop) {
ziti_log_init(loop, ZITI_LOG_DEFAULT_LEVEL, NULL);
metrics_init(loop, 5);

PREP(ziti);
PREPF(ziti, ziti_errorstr);

if (options->config == NULL && (options->controller == NULL || options->tls == NULL)) {
ZITI_LOG(ERROR, "config or controller/tls has to be set");
Expand Down

0 comments on commit fb902d2

Please sign in to comment.