diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index f2ceb0f7d66947ef3836d056f527a15a5def99f4..2143a32638c26c8f469e73f5343fafe7bfd0656c 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -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))