]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cfgparse: parse_cfg: fix null ptr dereference reported by coverity
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 9 Aug 2024 07:25:37 +0000 (09:25 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 9 Aug 2024 13:43:29 +0000 (15:43 +0200)
This commit fixes potential null ptr dereferences reported by coverity, see
more details about it in the issues #2676 and #2668.

'outline' ptr, which is initialized to NULL explicitly as a temporary buffer to
store split keywords may be in theory implicitly dereferenced in some corner
cases (which we haven't encountered yet with real world configurations) in
'if (!**args)'. parse_line() code, called before under some conditions
assigns: args[arg] = outline + outpos and outpos initial value is 0.

src/cfgparse.c

index bf43b02fd19599d5043e640d4c82aa92e0580f31..09b5b3a845e02fbe9f25895338583ca6640a1932 100644 (file)
@@ -2293,7 +2293,7 @@ next_line:
                /* end of config dump */
 
                /* empty line */
-               if (!**args)
+               if (!*args || !**args)
                        continue;
 
                /* check for config macros */