From 3453c3fc3516996fc9a96469249ee7a223e5e32b Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sun, 3 Apr 2022 16:23:16 -0700 Subject: Handle case of NULL dlpi_name 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 --- build-id.c | 5 +++-- 1 file 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. -- cgit v1.2.3