From: Felix Fietkau Date: Fri, 31 Jan 2025 11:29:28 +0000 (+0100) Subject: service: add missing null pointer check X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=75a236be122ab50df4c6b8476e8db8c20e1320b1;p=project%2Funetd.git service: add missing null pointer check Fixes crash when encountering a service without a valid member list Signed-off-by: Felix Fietkau --- 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];