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-next>] [day] [month] [year] [list]
Message-ID: <bd64b479-9d0e-cec8-d57a-5f188a822dd9@gmail.com>
Date:   Wed, 16 Feb 2022 23:35:43 +0300
From:   Maxim Petrov <mmrmaximuzz@...il.com>
To:     netdev@...r.kernel.org
Cc:     Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH v2 iproute2] lnstat: fix strdup leak in -w argument parsing

'tmp' string is copied for safe tokenizing, but it is not required after
getting all the widths in -w option. Use strdupa instead of strdup to avoid
explicit memory leak and to not trigger valgrind here.

Signed-off-by: Maxim Petrov <mmrmaximuzz@...il.com>
---
Changes in V2:
* Use strdupa instead of strdup/free

 misc/lnstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/lnstat.c b/misc/lnstat.c
index 98904d45..d7e1d8c9 100644
--- a/misc/lnstat.c
+++ b/misc/lnstat.c
@@ -314,7 +314,7 @@ int main(int argc, char **argv)
 			sscanf(optarg, "%u", &hdr);
 			break;
 		case 'w':
-			tmp = strdup(optarg);
+			tmp = strdupa(optarg);
 			if (!tmp)
 				break;
 			i = 0;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ