contrib/elfparser: be a bit more defensive

Related: #139
This commit is contained in:
Christian Hergert
2025-03-17 17:52:35 -07:00
parent 8ee813c9a9
commit 5dac046f2f

View File

@ -160,11 +160,17 @@ find_section (ElfParser *parser,
{
guint i;
if (name == NULL)
return NULL;
for (i = 0; i < parser->n_sections; ++i)
{
Section *section = parser->sections[i];
if (strcmp (section->name, name) == 0 && section->type == type)
if (section->name == NULL || section->type != type)
continue;
if (strcmp (section->name, name) == 0)
return section;
}