From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org
Subject: [perf PATCH] Fix possible unterminated readlink() result buffer
Date: Fri, 14 Oct 2011 19:00:47 +0200 [thread overview]
Message-ID: <4E986ABF.9040706@intra2net.com> (raw)
No need to do "buf[len] = '\0';" since the buffer
is allocated with zalloc().
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
| 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index b6c1ad1..1a1c026 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -267,7 +267,7 @@ int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir)
if (access(linkname, F_OK))
goto out_free;
- if (readlink(linkname, filename, size) < 0)
+ if (readlink(linkname, filename, size-1) < 0)
goto out_free;
if (unlink(linkname))
--
1.7.6.4
next reply other threads:[~2011-10-14 17:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 17:00 Thomas Jarosch [this message]
2011-10-14 17:26 ` [perf PATCH] Fix possible unterminated readlink() result buffer Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E986ABF.9040706@intra2net.com \
--to=thomas.jarosch@intra2net.com \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.