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>] [day] [month] [year] [list]
Date:   Tue, 21 May 2019 13:54:53 -0400
From:   Donald Yandt <donald.yandt@...il.com>
To:     peterz@...radead.org
Cc:     mingo@...hat.com, acme@...nel.org,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        yanmin_zhang@...ux.intel.com, linux-kernel@...r.kernel.org,
        Donald Yandt <donald.yandt@...il.com>
Subject: [PATCH perf/core] tools/perf/util/machine: Return NULL instead of null-terminating

Return NULL instead of null-terminating version char array when fgets fails due to end-of-file or error.

Signed-off-by: Donald Yandt <donald.yandt@...il.com>
---
 tools/perf/util/machine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 28a9541c4..6fd877220 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1235,9 +1235,9 @@ static char *get_kernel_version(const char *root_dir)
 		return NULL;

 	tmp = fgets(version, sizeof(version), file);
-	if (!tmp)
-		*version = '\0';
 	fclose(file);
+	if (!tmp)
+		return NULL;

 	name = strstr(version, prefix);
 	if (!name)
--
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ