Skip to content
Snippets Groups Projects
Commit bb1932c9 authored by David Bauer's avatar David Bauer
Browse files

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: default avatarMatthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: default avatarDavid Bauer <mail@david-bauer.net>
(cherry picked from commit 7e1e9fe2)
parent a50834f8
No related branches found
No related tags found
No related merge requests found
......@@ -60,11 +60,11 @@ static struct json_object * get_bandwidth_limit(void) {
enabled = true;
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);
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);
if (egress >= 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment