mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
pe-binary: fix array overrun
This is a kind of paranoia, as memeqzero() does not read anyting if length is zero. But, strictly speaking C language does not allow such, and Coverity warn about that. Fixes CID#1561177. (cherry picked from commit 6529ab0b066c93a6b8a8bf24b999d67e67a261f5)
This commit is contained in:
parent
2e742418e5
commit
73986494b6
@ -58,7 +58,7 @@ const IMAGE_SECTION_HEADER* pe_section_table_find(
|
||||
|
||||
FOREACH_ARRAY(section, sections, n_sections)
|
||||
if (memcmp(section->Name, name, n) == 0 &&
|
||||
memeqzero(section->Name + n, sizeof(section->Name) - n))
|
||||
(n == sizeof(sections[0].Name) || memeqzero(section->Name + n, sizeof(section->Name) - n)))
|
||||
return section;
|
||||
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user