libelf: section index 0 is special When iterating over sections, table entry zero needs to be ignored. Signed-off-by: Jan Beulich --- a/xen/common/libelf/libelf-dominfo.c +++ b/xen/common/libelf/libelf-dominfo.c @@ -536,7 +536,7 @@ elf_errorstatus elf_xen_parse(struct elf if ( xen_elfnotes == 0 ) { count = elf_shdr_count(elf); - for ( i = 0; i < count; i++ ) + for ( i = 1; i < count; i++ ) { shdr = elf_shdr_by_index(elf, i); if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) --- a/xen/common/libelf/libelf-loader.c +++ b/xen/common/libelf/libelf-loader.c @@ -79,7 +79,7 @@ elf_errorstatus elf_init(struct elf_bina /* Find symbol table and symbol string table. */ count = elf_shdr_count(elf); - for ( i = 0; i < count; i++ ) + for ( i = 1; i < count; i++ ) { shdr = elf_shdr_by_index(elf, i); if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) --- a/xen/common/libelf/libelf-tools.c +++ b/xen/common/libelf/libelf-tools.c @@ -153,7 +153,7 @@ ELF_HANDLE_DECL(elf_shdr) elf_shdr_by_na const char *sname; unsigned i; - for ( i = 0; i < count; i++ ) + for ( i = 1; i < count; i++ ) { shdr = elf_shdr_by_index(elf, i); if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) )