From 75a236be122ab50df4c6b8476e8db8c20e1320b1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 31 Jan 2025 12:29:28 +0100 Subject: [PATCH] service: add missing null pointer check Fixes crash when encountering a service without a valid member list Signed-off-by: Felix Fietkau --- service.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]; -- 2.30.2