summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-01-31 11:29:28 +0000
committerFelix Fietkau2025-01-31 11:29:51 +0000
commit75a236be122ab50df4c6b8476e8db8c20e1320b1 (patch)
tree5072a76a176c45a71a8985ca8273e47b10f4dfe9
parent082b5482b97f20dc4745bc3d645e33b584cc28e4 (diff)
service: add missing null pointer check
Fixes crash when encountering a service without a valid member list Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--service.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/service.c b/service.c
index 5237915..0050c23 100644
--- a/service.c
+++ b/service.c
@@ -120,7 +120,8 @@ service_add(struct network *net, struct blob_attr *data)
if ((cur = tb[SERVICE_ATTR_TYPE]) != NULL)
type = blobmsg_get_string(cur);
- if (blobmsg_check_array(tb[SERVICE_ATTR_MEMBERS], BLOBMSG_TYPE_STRING) < 0)
+ if (!tb[SERVICE_ATTR_MEMBERS] ||
+ blobmsg_check_array(tb[SERVICE_ATTR_MEMBERS], BLOBMSG_TYPE_STRING) < 0)
return;
config = tb[SERVICE_ATTR_CONFIG];