mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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/[email protected] Signed-off-by: Thomas Jarosch <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
0361fc25d5
commit
6c3c5b26d0
1 changed files with 1 additions and 1 deletions
|
|
@ -1289,7 +1289,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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue