Fix access violation when reporting sections that could not be dumped.
authorNick Clifton <nickc@redhat.com>
Mon, 13 Feb 2017 14:17:07 +0000 (14:17 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 13 Feb 2017 14:17:07 +0000 (14:17 +0000)
PR binutils/21147
* readelf.c (process_section_contents): Fix off by one error
reporting un-dumped sections.

binutils/ChangeLog
binutils/readelf.c

index 254268945c97d4c64e58216af1f30c4c54255252..f099467d3fd5484e3e6a737c4a1e8fdd98cc58b2 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-13  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/21147
+       * readelf.c (process_section_contents): Fix off by one error
+       reporting un-dumped sections.
+
 2017-02-13  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/21139
index de961c4830316c6666e7c80b6bbdb8168498a920..6fd7ff7a1e6ed2294e195db0ea1346340997a4db 100644 (file)
@@ -13172,9 +13172,12 @@ process_section_contents (FILE * file)
 
   /* Check to see if the user requested a
      dump of a section that does not exist.  */
-  while (i++ < num_dump_sects)
-    if (dump_sects[i])
-      warn (_("Section %d was not dumped because it does not exist!\n"), i);
+  while (i < num_dump_sects)
+    {
+      if (dump_sects[i])
+       warn (_("Section %d was not dumped because it does not exist!\n"), i);
+      i++;
+    }
 }
 
 static void