[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170322130624.21881-5-tommi.t.rantala@nokia.com>
Date: Wed, 22 Mar 2017 15:06:22 +0200
From: Tommi Rantala <tommi.t.rantala@...ia.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>
CC: <linux-kernel@...r.kernel.org>,
Tommi Rantala <tommi.t.rantala@...ia.com>
Subject: [PATCH 4/6] 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>
---
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..ab10e9d 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;
--
2.9.3
Powered by blists - more mailing lists