summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2022-04-03 16:23:16 -0700
committerMatt Turner <mattst88@gmail.com>2022-04-03 16:23:16 -0700
commit3453c3fc3516996fc9a96469249ee7a223e5e32b (patch)
tree81740ff1dab0e59aa461c5a4f46c6fd32c6bda6c
parent72ea519e3563df60fe81a9534e0b8b85bd63a37f (diff)
Handle case of NULL dlpi_nameHEADmaster
Apparently this can happen on some versions of Android. Fixed in Mesa with commit 70d25cae8b9 ("util/build-id: check dlpi_name before strstr call"). Closes: https://github.com/mattst88/build-id/issues/5
-rw-r--r--build-id.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/build-id.c b/build-id.c
index 900f507..f262d70 100644
--- a/build-id.c
+++ b/build-id.c
@@ -65,8 +65,9 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_)
{
struct callback_data *data = data_;
- if (data->tag == BY_NAME && strcmp(info->dlpi_name, data->name) != 0)
- return 0;
+ if (data->tag == BY_NAME)
+ if (!info->dlpi_name || strcmp(info->dlpi_name, data->name) != 0)
+ return 0;
if (data->tag == BY_SYMBOL) {
/* Calculate address where shared object is mapped into the process space.