[OpenWrt-Devel] [PATCH libubox 1/3] blobmsg: fix length in blobmsg_check_array

Felix Fietkau nbd at nbd.name
Mon May 25 11:19:06 EDT 2020


blobmsg_check_array_len expects the length of the full attribute buffer,
not just the data length.
Due to other missing length checks (fixed in the next commit), this did
not show up as a test failure

Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 blobmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/blobmsg.c b/blobmsg.c
index 59045e1672c8..daaa9fc8444b 100644
--- a/blobmsg.c
+++ b/blobmsg.c
@@ -114,7 +114,7 @@ bool blobmsg_check_attr_len(const struct blob_attr *attr, bool name, size_t len)
 
 int blobmsg_check_array(const struct blob_attr *attr, int type)
 {
-	return blobmsg_check_array_len(attr, type, blob_len(attr));
+	return blobmsg_check_array_len(attr, type, blob_raw_len(attr));
 }
 
 int blobmsg_check_array_len(const struct blob_attr *attr, int type,
-- 
2.24.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list