Fix possible unterminated readlink() result buffer
PATCH 1/1 Fix possible unterminated readlink() result buffer
No need to do "buf[len] = '\0';" since the buffer
is allocated with zalloc().
Signed-off-by Thomas Jarosch <[email protected]>
--- tools/perf/util/header.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/header.c +1 -1
@@ -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))
Signature · 1 line
1.7.6.4
Arnaldo Carvalho de Melo
AppliedEm Fri, Oct 14, 2011 at 07:00:47PM +0200, Thomas Jarosch escreveu:
Quoted 4 lines
No need to do "buf[len] = '\0';" since the buffer
is allocated withzalloc().Signed-off-by Thomas Jarosch <[email protected]>
Thanks, applied.
- Arnaldo