diff options
author | Thomas Jarosch <thomas.jarosch@intra2net.com> | 2011-10-14 13:00:47 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-14 11:49:35 -0400 |
commit | 6c3c5b26d08569ed80e10d3e02d3c997ed1e6e7c (patch) | |
tree | 78ea18b888811922e50ceef80bb33321fa01687d /tools | |
parent | 0361fc25d509be09464dd23c274bd175cc933cc8 (diff) |
perf buildid: Fix possible unterminated readlink() result buffer
The readlink function doesn't guarantee that a '\0' will be put at the
end of the provided buffer if there is no space left.
No need to do "buf[len] = '\0';" since the buffer is allocated with
zalloc().
Link: http://lkml.kernel.org/r/4E986ABF.9040706@intra2net.com
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/header.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index f2ceb0f7d669..2143a32638c2 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -1289,7 +1289,7 @@ int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir) | |||
1289 | if (access(linkname, F_OK)) | 1289 | if (access(linkname, F_OK)) |
1290 | goto out_free; | 1290 | goto out_free; |
1291 | 1291 | ||
1292 | if (readlink(linkname, filename, size) < 0) | 1292 | if (readlink(linkname, filename, size - 1) < 0) |
1293 | goto out_free; | 1293 | goto out_free; |
1294 | 1294 | ||
1295 | if (unlink(linkname)) | 1295 | if (unlink(linkname)) |