util/build-id: check dlpi_name before strstr call
authorTapani Pälli <tapani.palli@intel.com>
Thu, 16 Mar 2017 06:10:57 +0000 (08:10 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Fri, 17 Mar 2017 05:34:26 +0000 (07:34 +0200)
commit70d25cae8b9769d155eb8cabf4095f2b36d9265f
treecdbbec0b0b6287ae4075a5e3114fb8e22c6e267c
parent4d4558411db166d2d66f8cec9cb581149dbe1597
util/build-id: check dlpi_name before strstr call

According to dl_iterate_phdr man page first object visited is the
main program where dlpi_name is an empty string. This fixes segfault
on Android when using build-id as identifier.

Fixes: d4fa083e11f ("util: Add utility build-id code.")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/util/build_id.c