]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
perf tools: Initialize output buffer in build_id__sprintf
authorJiri Olsa <jolsa@kernel.org>
Sun, 1 Nov 2020 23:31:02 +0000 (00:31 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 3 Nov 2020 12:14:45 +0000 (09:14 -0300)
We display garbage for undefined build_id objects, because we don't
initialize the output buffer.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20201101233103.3537427-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/build-id.c

index 8763772f1095e9774cfa30cafadaab6b180ac0c1..6b410c3d52dca948253eca99716536c4761a809a 100644 (file)
@@ -102,6 +102,8 @@ int build_id__sprintf(const struct build_id *build_id, char *bf)
        const u8 *raw = build_id->data;
        size_t i;
 
+       bf[0] = 0x0;
+
        for (i = 0; i < build_id->size; ++i) {
                sprintf(bid, "%02x", *raw);
                ++raw;