* [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>
---
| 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [perf PATCH] Fix possible unterminated readlink() result buffer
2011-10-14 17:00 [perf PATCH] Fix possible unterminated readlink() result buffer Thomas Jarosch
@ 2011-10-14 17:26 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-10-14 17:26 UTC (permalink / raw)
To: Thomas Jarosch; +Cc: linux-kernel
Em Fri, Oct 14, 2011 at 07:00:47PM +0200, Thomas Jarosch escreveu:
> No need to do "buf[len] = '\0';" since the buffer
> is allocated with zalloc().
>
> Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Thanks, applied.
- Arnaldo
^ permalink raw reply [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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox