]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: fix possible parser crash when parsing erroneous "http-request...
authorWilly Tarreau <w@1wt.eu>
Mon, 18 Nov 2013 17:04:25 +0000 (18:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Nov 2013 17:07:35 +0000 (18:07 +0100)
Baptiste Assmann reported a bug affecting the "http-request redirect"
parser. It may randomly crash when reporting an error message if the
syntax is not OK. It happens that this is caused by the output error
message pointer which was not initialized to NULL.

This bug is 1.5-specific (introduced in dev17), no backport is needed.

src/proto_http.c

index e82516734ae4754792fde40f2f01ec181863e0fb..f037b1edd090a6caf5ac08c2aefa919c37fc797c 100644 (file)
@@ -8491,7 +8491,7 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i
                cur_arg += 2;
        } else if (strcmp(args[0], "redirect") == 0) {
                struct redirect_rule *redir;
-               char *errmsg;
+               char *errmsg = NULL;
 
                if ((redir = http_parse_redirect_rule(file, linenum, proxy, (const char **)args + 1, &errmsg)) == NULL) {
                        Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n",