lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 15 Mar 2024 07:53:29 +0530
From: Ratheesh Kannoth <rkannoth@...vell.com>
To: Denis Kirjanov <kirjanov@...il.com>
CC: <stephen@...workplumber.org>, <dsahern@...nel.org>,
        <netdev@...r.kernel.org>, Denis Kirjanov <dkirjanov@...e.de>
Subject: Re: [PATCH iproute2] ifstat: handle strdup return value

On 2024-03-14 at 17:50:40, Denis Kirjanov (kirjanov@...il.com) wrote:
> get_nlmsg_extended missing the check as it's done
> in get_nlmsg
>
> Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
> ---
>  misc/ifstat.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/misc/ifstat.c b/misc/ifstat.c
> index 685e66c9..f94b11bc 100644
> --- a/misc/ifstat.c
> +++ b/misc/ifstat.c
> @@ -140,6 +140,11 @@ static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
>
>  	n->ifindex = ifsm->ifindex;
>  	n->name = strdup(ll_index_to_name(ifsm->ifindex));
> +	if (!n->name) {
> +		free(n);
> +		errno = ENOMEM;
strdup() will set the errno right ? why do you need to set it explicitly ?
> +		return -1;
> +	}
>
>  	if (sub_type == NO_SUB_TYPE) {
>  		memcpy(&n->val, RTA_DATA(tb[filter_type]), sizeof(n->val));
> --
> 2.30.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ