[OpenWrt-Devel] [PATCH v2 2/3] Replace use of blobmsg_check_attr by blobmsg_check_attr_safe

Felix Fietkau nbd at nbd.name
Tue Nov 27 03:52:23 EST 2018


On 2018-11-23 07:27, Tobias Schramm wrote:
> blobmsg_check_attr_safe adds a length limit specifying the max offset from attr that
> can be read safely
> 
> Signed-off-by: Tobias Schramm <tobleminer at gmail.com>
> ---
>  blobmsg.c | 27 ++++++++++++++++++++++-----
>  blobmsg.h | 18 ++++++++++++++++++
>  2 files changed, 40 insertions(+), 5 deletions(-)
> 
> diff --git a/blobmsg.c b/blobmsg.c
> index 8019c45..dd4b506 100644
> --- a/blobmsg.c
> +++ b/blobmsg.c
> @@ -32,18 +32,33 @@ blobmsg_namelen(const struct blobmsg_hdr *hdr)
>  }
>  
>  bool blobmsg_check_attr(const struct blob_attr *attr, bool name)
> +{
> +	return blobmsg_check_attr_safe(attr, name, blob_raw_len(attr));
> +}
Please make blobmsg_check_attr an inline function in blobmsg.h

- 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