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] [day] [month] [year] [list]
Message-ID: <20250720081207.6d3d91d6@hermes.local>
Date: Sun, 20 Jul 2025 08:12:07 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Anton Moryakov <ant.v.moryakov@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next] misc: fix memory leak in ifstat.c

On Sat, 19 Jul 2025 13:18:52 +0300
Anton Moryakov <ant.v.moryakov@...il.com> wrote:

> A memory leak was detected by the static analyzer SVACE in the function
> get_nlmsg_extended(). The issue occurred when parsing extended interface
> statistics failed due to a missing nested attribute. In this case,
> memory allocated for 'n->name' via strdup() was not freed before returning,
> resulting in a leak.
> 
> The fix adds an explicit 'free(n->name)' call before freeing the containing
> structure in the error path.
> 
> Reported-by: SVACE static analyzer
> Signed-off-by: Anton Moryakov <ant.v.moryakov@...il.com>
> ---
>  misc/ifstat.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/misc/ifstat.c b/misc/ifstat.c
> index 4ce5ca8a..5b59fd8f 100644
> --- a/misc/ifstat.c
> +++ b/misc/ifstat.c
> @@ -139,6 +139,7 @@ static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
>  		attr = parse_rtattr_one_nested(sub_type, tb[filter_type]);
>  		if (attr == NULL) {
>  			free(n);
> +			free(n->name);

No. A use after free is worse than a leak.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ