perf symbols: Fix use after free in filename__read_build_id
authorMitchell Krome <mitchellkrome@gmail.com>
Tue, 16 Dec 2014 02:16:12 +0000 (12:16 +1000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 17 Dec 2014 14:58:17 +0000 (11:58 -0300)
commit7ad74b41e56e4f7f42c6b765bc44428cd09310d7
treed8e8763a585680ce52245c93c764f3eff124f3df
parent91529834d1dea9afccb72843c3e547e703ec177f
perf symbols: Fix use after free in filename__read_build_id

In filename__read_build_id, phdr points to memory in buf, which gets realloced
before a call to fseek that uses phdr->p_offset. This change stores the value
of p_offset before buf is realloced, so the fseek can use the value safely.

Signed-off-by: Mitchell Krome <mitchellkrome@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20141216021612.GA7199@mitchell
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/symbol-minimal.c