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]
Message-ID: <tip-b7126ef78612a3d4a37aadf39125cff048cebb9b@git.kernel.org>
Date:   Mon, 27 Mar 2017 22:58:00 -0700
From:   tip-bot for Tommi Rantala <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     mingo@...nel.org, acme@...hat.com, tglx@...utronix.de,
        linux-kernel@...r.kernel.org, peterz@...radead.org,
        alexander.shishkin@...ux.intel.com, tommi.t.rantala@...ia.com,
        hpa@...or.com
Subject: [tip:perf/core] perf utils: use sizeof(buf) - 1 in readlink() call

Commit-ID:  b7126ef78612a3d4a37aadf39125cff048cebb9b
Gitweb:     http://git.kernel.org/tip/b7126ef78612a3d4a37aadf39125cff048cebb9b
Author:     Tommi Rantala <tommi.t.rantala@...ia.com>
AuthorDate: Wed, 22 Mar 2017 15:06:22 +0200
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 27 Mar 2017 15:36:27 -0300

perf utils: use sizeof(buf) - 1 in readlink() call

Ensure that we have space for the null byte in buf.

Signed-off-by: Tommi Rantala <tommi.t.rantala@...ia.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/20170322130624.21881-5-tommi.t.rantala@nokia.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 05714d5..cf22962 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -378,7 +378,7 @@ static int write_cmdline(int fd, struct perf_header *h __maybe_unused,
 	 * actual atual path to perf binary
 	 */
 	sprintf(proc, "/proc/%d/exe", getpid());
-	ret = readlink(proc, buf, sizeof(buf));
+	ret = readlink(proc, buf, sizeof(buf) - 1);
 	if (ret <= 0)
 		return -1;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ