summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens2026-04-12 22:07:13 +0000
committerHauke Mehrtens2026-05-23 00:46:46 +0000
commit9105ea2a349a2f0de334e8b661baa76e21e47d13 (patch)
tree04673d728a0375a8f6672f5bc8569e8dd660e77a
parent8b5be570f13e49adf0ccc1c4fb77b0649992842d (diff)
downloadubus-9105ea2a349a2f0de334e8b661baa76e21e47d13.tar.gz
ubusd_acl: fix NULL dereference on OOM in ubusd_acl_alloc_obj
calloc_a() can return NULL under memory pressure. The returned pointer was dereferenced immediately on the next line without a NULL check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Link: https://github.com/openwrt/ubus/pull/20 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--ubusd_acl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ubusd_acl.c b/ubusd_acl.c
index a5429cd..ac47f5b 100644
--- a/ubusd_acl.c
+++ b/ubusd_acl.c
@@ -316,6 +316,8 @@ ubusd_acl_alloc_obj(struct ubusd_acl_file *file, const char *obj)
}
o = calloc_a(sizeof(*o), &k, len + 1);
+ if (!o)
+ return NULL;
o->partial = partial;
o->user = file->user;
o->group = file->group;