http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54800
Ian Lance Taylor <ian at airs dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ian at airs dot com --- Comment #2 from Ian Lance Taylor <ian at airs dot com> 2013-01-01 16:34:09 UTC --- I think the correct patch is the following, but I have no way to test it. Index: simple-object-mach-o.c =================================================================== --- simple-object-mach-o.c (revision 194764) +++ simple-object-mach-o.c (working copy) @@ -701,12 +701,13 @@ simple_object_mach_o_segment (simple_obj /* Otherwise, make a name like __segment,__section as per the convention in mach-o asm. */ name = &namebuf[0]; - memset (namebuf, 0, MACH_O_NAME_LEN * 2 + 2); memcpy (namebuf, (char *) sechdr + segname_offset, MACH_O_NAME_LEN); + namebuf[MACH_O_NAME_LEN] = '\0'; l = strlen (namebuf); namebuf[l] = ','; memcpy (namebuf + l + 1, (char *) sechdr + sectname_offset, MACH_O_NAME_LEN); + namebuf[l + 1 + MACH_O_NAME_LEN] = '\0'; } simple_object_mach_o_section_info (omr->is_big_endian, is_32, sechdr,