]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix off-by-one in simple-object-elf.c (PR lto/91228).
authorMartin Liska <mliska@suse.cz>
Wed, 24 Jul 2019 07:00:48 +0000 (09:00 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 24 Jul 2019 07:00:48 +0000 (07:00 +0000)
2019-07-24  Martin Liska  <mliska@suse.cz>

PR lto/91228
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Find first '\0' starting from gnu_lto + 1.

From-SVN: r273757

libiberty/ChangeLog
libiberty/simple-object-elf.c

index ddd96183e010d0e4cc41530bd5c9f98df308cd34..c22d49f157a3fab707eec0ca3c279f7ac7974461 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-24  Martin Liska  <mliska@suse.cz>
+
+       PR lto/91228
+       * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
+       Find first '\0' starting from gnu_lto + 1.
+
 2019-07-12  Ren Kimura  <rkx1209dev@gmail.com>
 
        * simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx.
index bdee963634d6846224558b01ddfe25526715e170..7515926659694ba930aa0a7d1a22e84b05c117c8 100644 (file)
@@ -1388,8 +1388,8 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
                                       (unsigned char *)strings,
                                       strsz, &errmsg, err);
          /* Find first '\0' in strings.  */
-         gnu_lto = (char *) memchr (gnu_lto, '\0',
-                                    strings + strsz - gnu_lto + 1);
+         gnu_lto = (char *) memchr (gnu_lto + 1, '\0',
+                                    strings + strsz - gnu_lto);
          /* Read the section index table if present.  */
          if (symtab_indices_shndx[i - 1] != 0)
            {