From: Felix Fietkau Date: Tue, 16 Aug 2022 15:48:07 +0000 (+0200) Subject: network: check for empty string arguments X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=8e77d44b3e619e5a5c8ba0ebe13f7cbc51d3948a;p=project%2Funetd.git network: check for empty string arguments Signed-off-by: Felix Fietkau --- diff --git a/network.c b/network.c index 80909c4..15429ad 100644 --- a/network.c +++ b/network.c @@ -474,6 +474,7 @@ network_set_config(struct network *net, struct blob_attr *config) blobmsg_len(net->config.data)); if ((cur = tb[NETWORK_ATTR_TYPE]) == NULL || + !strlen(blobmsg_get_string(cur)) || !strcmp(blobmsg_get_string(cur), "dynamic")) net->config.type = NETWORK_TYPE_DYNAMIC; else if (!strcmp(blobmsg_get_string(cur), "file")) @@ -510,13 +511,16 @@ network_set_config(struct network *net, struct blob_attr *config) break; } - if ((cur = tb[NETWORK_ATTR_INTERFACE]) != NULL) + if ((cur = tb[NETWORK_ATTR_INTERFACE]) != NULL && + strlen(blobmsg_get_string(cur)) > 0) net->config.interface = blobmsg_get_string(cur); - if ((cur = tb[NETWORK_ATTR_UPDATE_CMD]) != NULL) + if ((cur = tb[NETWORK_ATTR_UPDATE_CMD]) != NULL && + strlen(blobmsg_get_string(cur)) > 0) net->config.update_cmd = blobmsg_get_string(cur); - if ((cur = tb[NETWORK_ATTR_DOMAIN]) != NULL) + if ((cur = tb[NETWORK_ATTR_DOMAIN]) != NULL && + strlen(blobmsg_get_string(cur)) > 0) net->config.domain = blobmsg_get_string(cur); if ((cur = tb[NETWORK_ATTR_TUNNELS]) != NULL)