All of lore.kernel.org
 help / color / mirror / Atom feed
* [perf PATCH] Fix possible unterminated readlink() result buffer
@ 2011-10-14 17:00 Thomas Jarosch
  2011-10-14 17:26 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Jarosch @ 2011-10-14 17:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel

No need to do "buf[len] = '\0';" since the buffer
is allocated with zalloc().

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
 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 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-14 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14 17:00 [perf PATCH] Fix possible unterminated readlink() result buffer Thomas Jarosch
2011-10-14 17:26 ` Arnaldo Carvalho de Melo

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.