[OpenWrt-Devel] [PATCH v3 3/3] Add _safe variants for all attribute checking methods
Felix Fietkau
nbd at nbd.name
Wed Nov 28 06:52:10 EST 2018
On 2018-11-28 02:35, Tobias Schramm wrote:
> Signed-off-by: Tobias Schramm <tobleminer at gmail.com>
> ---
> blobmsg.c | 12 ++++++++++--
> blobmsg.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 58 insertions(+), 3 deletions(-)
>
> diff --git a/blobmsg.c b/blobmsg.c
> index 10f3801..4b142e9 100644
> --- a/blobmsg.c
> +++ b/blobmsg.c
> @@ -75,13 +75,16 @@ bool blobmsg_check_attr_safe(const struct blob_attr *attr, bool name, size_t len
> return blob_check_type(data, data_len, blob_type[id]);
> }
>
> -int blobmsg_check_array(const struct blob_attr *attr, int type)
> +int blobmsg_check_array_safe(const struct blob_attr *attr, int type, size_t len)
> {
> struct blob_attr *cur;
> bool name;
> int rem;
> int size = 0;
>
> + if (!blobmsg_check_attr_safe(attr, NULL, len))
The second argument is a bool, so you should replace NULL with false.
Thanks,
- Felix
_______________________________________________
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