]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: deviceatlas: add NULL checks on strdup() results in config parsers
authorDavid Carlier <dcarlier@deviceatlas.com>
Sat, 14 Feb 2026 13:23:56 +0000 (13:23 +0000)
committerWilly Tarreau <w@1wt.eu>
Sat, 14 Feb 2026 13:47:22 +0000 (14:47 +0100)
Add missing NULL checks after strdup() for the json file path in
da_json_file() and the cookie name in da_properties_cookie().

This should be backported to lower branches.

addons/deviceatlas/da.c

index e9fb91d1a112ab74e6a95708e2be390131a760c4..3b157667832f172cbb5d205c31af4674399c1c5f 100644 (file)
@@ -57,6 +57,10 @@ static int da_json_file(char **args, int section_type, struct proxy *curpx,
                return -1;
        }
        global_deviceatlas.jsonpath = strdup(args[1]);
+       if (unlikely(global_deviceatlas.jsonpath == NULL)) {
+               memprintf(err, "deviceatlas json file : out of memory.\n");
+               return -1;
+       }
        return 0;
 }
 
@@ -102,6 +106,10 @@ static int da_properties_cookie(char **args, int section_type, struct proxy *cur
                return -1;
        } else {
                global_deviceatlas.cookiename = strdup(args[1]);
+               if (unlikely(global_deviceatlas.cookiename == NULL)) {
+                       memprintf(err, "deviceatlas cookie name : out of memory.\n");
+                       return -1;
+               }
        }
        global_deviceatlas.cookienamelen = strlen(global_deviceatlas.cookiename);
        return 0;