]> xenbits.xensource.com Git - xen.git/commitdiff
libelf: section index 0 is special
authorJan Beulich <jbeulich@suse.com>
Wed, 18 Jan 2017 08:45:54 +0000 (09:45 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 18 Jan 2017 08:45:54 +0000 (09:45 +0100)
When iterating over sections, table entry zero needs to be ignored.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 41fe9cabf29ea15c1f8edee49326dfde705013d3
master date: 2016-12-07 13:52:35 +0100

xen/common/libelf/libelf-dominfo.c
xen/common/libelf/libelf-loader.c
xen/common/libelf/libelf-tools.c

index 85c14da4e7249fc69b01c4f24375db8041fc9d56..a52900c00cde2932fc40454b5a420a401a7c7e36 100644 (file)
@@ -536,7 +536,7 @@ elf_errorstatus elf_xen_parse(struct elf_binary *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) )
index 4e12a715b6219c5f7bb7d7ca5d0af5526f9e2bca..c324f5ecc11bca5f66796e732ff1dabdb835f999 100644 (file)
@@ -79,7 +79,7 @@ elf_errorstatus elf_init(struct elf_binary *elf, const char *image_input, size_t
 
     /* 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) )
index e73e729fff03215565e0a2786b0dca25ecaffbb8..0197b858190c134d152c78d2a36ea29890e7bd99 100644 (file)
@@ -153,7 +153,7 @@ ELF_HANDLE_DECL(elf_shdr) elf_shdr_by_name(struct elf_binary *elf, const char *n
     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) )