libubox: backport blobmsg_check_array() fix
[oweals/openwrt.git] / package / libs / libubox / patches / 0017-blobmsg-fix-wrong-payload-len-passed-from-blobmsg_ch.patch
1 From 75e300aeec25e032a9778bea34c713969960d1f0 Mon Sep 17 00:00:00 2001
2 From: Chris Nisbet <nischris@gmail.com>
3 Date: Wed, 12 Feb 2020 21:00:31 +1300
4 Subject: [PATCH] blobmsg: fix wrong payload len passed from
5  blobmsg_check_array
6
7 Fix incorrect use of blobmsg_len() on passed blobmsg to
8 blobmsg_check_array_len() introduced in commit 379cd33d1992
9 ("fix wrong payload len passed from blobmsg_check_array") by using correct
10 blob_len().
11
12 By using blobmsg_len() a value too small was passed to blobmsg_check_array()
13 which could lead to this function returning an error when there is none.
14
15 Fixes: 379cd33d1992 ("fix wrong payload len passed from blobmsg_check_array")
16 Signed-off-by: Chris Nisbet <nischris@gmail.com>
17 [add fixes tag, rewrap commit message]
18 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
19 ---
20  blobmsg.c | 2 +-
21  1 file changed, 1 insertion(+), 1 deletion(-)
22
23 --- a/blobmsg.c
24 +++ b/blobmsg.c
25 @@ -120,7 +120,7 @@ bool blobmsg_check_attr_len(const struct
26  
27  int blobmsg_check_array(const struct blob_attr *attr, int type)
28  {
29 -       return blobmsg_check_array_len(attr, type, blobmsg_len(attr));
30 +       return blobmsg_check_array_len(attr, type, blob_len(attr));
31  }
32  
33  int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)