blobmsg: fix wrong payload len passed from blobmsg_check_array
authorChris Nisbet <nischris@gmail.com>
Wed, 12 Feb 2020 08:00:31 +0000 (21:00 +1300)
committerJo-Philipp Wich <jo@mein.io>
Thu, 27 Feb 2020 20:56:01 +0000 (21:56 +0100)
Fix incorrect use of blobmsg_len() on passed blobmsg to
blobmsg_check_array_len() introduced in commit 379cd33d1992
("fix wrong payload len passed from blobmsg_check_array") by using correct
blob_len().

By using blobmsg_len() a value too small was passed to blobmsg_check_array()
which could lead to this function returning an error when there is none.

Fixes: 379cd33d1992 ("fix wrong payload len passed from blobmsg_check_array")
Signed-off-by: Chris Nisbet <nischris@gmail.com>
[add fixes tag, rewrap commit message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
blobmsg.c

index 762078436f9bba18c5b105831d5db2a69b50e7a5..8b9877d7ce9e1cec5d0a37c0488244196d35575f 100644 (file)
--- 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)
 {
 
 int blobmsg_check_array(const struct blob_attr *attr, int type)
 {
-       return blobmsg_check_array_len(attr, type, blobmsg_len(attr));
+       return blobmsg_check_array_len(attr, type, blob_len(attr));
 }
 
 int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)
 }
 
 int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)