[PATCH] libubox: add missing NULL check
Rosen Penev
rosenp at gmail.com
Wed Jun 22 11:58:00 PDT 2022
strlen takes non NULL parameters. Found with GCC's -fanalyzer.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
blobmsg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/blobmsg.c b/blobmsg.c
index d87d607..bb6c469 100644
--- a/blobmsg.c
+++ b/blobmsg.c
@@ -364,6 +364,8 @@ blobmsg_add_string_buffer(struct blob_buf *buf)
int len, attrlen;
attr = blob_next(buf->head);
+ if (!attr)
+ return;
len = strlen(blobmsg_data(attr)) + 1;
attrlen = blob_raw_len(attr) + len;
--
2.36.1
More information about the openwrt-devel
mailing list