mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-19 02:29:31 -05:00
BUG/MINOR: deviceatlas: add NULL checks on strdup() results in config parsers
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.
This commit is contained in:
parent
2d6e9e15cd
commit
6342705cee
1 changed files with 8 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue