From: Willy Tarreau Date: Thu, 20 Dec 2012 17:19:26 +0000 (+0100) Subject: BUG/MEDIUM: log: fix possible segfault during config parsing X-Git-Tag: v1.5-dev16~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=254d44c01492eef2e2249a5b186f37afd23eac63;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: log: fix possible segfault during config parsing When log format arguments are specified within braces with no '+' nor '-' prefix, the NULL string is compared with known keywords causing a crash. This only happens during parsing so it does not affect runtime processing. --- diff --git a/src/log.c b/src/log.c index 7483842c48..e5d4ce8d3b 100644 --- a/src/log.c +++ b/src/log.c @@ -184,7 +184,7 @@ int parse_logformat_var_args(char *args, struct logformat_node *node) if (*args == '\0' || *args == ',') { *args = '\0'; - for (i = 0; var_args_list[i].name; i++) { + for (i = 0; sp && var_args_list[i].name; i++) { if (strcmp(sp, var_args_list[i].name) == 0) { if (flags == 1) { node->options |= var_args_list[i].mask; @@ -199,7 +199,7 @@ int parse_logformat_var_args(char *args, struct logformat_node *node) if (end) break; } - args++; + args++; } return 0; }