gluon-mesh-vpn-core: avoid reading null pointer
In case the limit_ingress or limit_egress options are not present in gluon's mesh_vpn section the respondd provider compares a string literal with a NULL pointer, crashing respondd. Check both pointers prior to comparing them in order to mitigate this issue. Suggested-by: Matthias Schiffer <mschiffer@universe-factory.net> Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
parent
867b18deeb
commit
7e1e9fe2bd
@ -60,11 +60,11 @@ static struct json_object * get_bandwidth_limit(void) {
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
|
|
||||||
const char *egress_str = uci_lookup_option_string(ctx, s, "limit_egress");
|
const char *egress_str = uci_lookup_option_string(ctx, s, "limit_egress");
|
||||||
if (strcmp(egress_str, "-"))
|
if (egress_str && strcmp(egress_str, "-"))
|
||||||
egress = atoi(egress_str);
|
egress = atoi(egress_str);
|
||||||
|
|
||||||
const char *ingress_str = uci_lookup_option_string(ctx, s, "limit_ingress");
|
const char *ingress_str = uci_lookup_option_string(ctx, s, "limit_ingress");
|
||||||
if (strcmp(ingress_str, "-"))
|
if (ingress_str && strcmp(ingress_str, "-"))
|
||||||
ingress = atoi(ingress_str);
|
ingress = atoi(ingress_str);
|
||||||
|
|
||||||
if (egress >= 0)
|
if (egress >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user