1 diff -u -r ../elfutils-0.166/src/ldgeneric.c ./src/ldgeneric.c
2 --- ../elfutils-0.166/src/ldgeneric.c 2015-08-21 08:22:37.000000000 -0400
3 +++ ./src/ldgeneric.c 2016-05-04 15:20:09.029651147 -0400
6 /* The content of the file is available in memory. Read the
7 memory region as a stream. */
10 + fwrite(content, 1, contentsize, ldin);
13 ldin = fmemopen (content, contentsize, "r");
17 /* No need for locking. */
19 /* Callback function registered with on_exit to make sure the temporary
20 files gets removed if something goes wrong. */
22 -remove_tempfile (int status, void *arg)
25 - if (status != 0 && ld_state.tempfname != NULL)
26 + if (ld_state.tempfname != NULL)
27 unlink (ld_state.tempfname);
32 /* Make sure we remove the temporary file in case something goes
34 - on_exit (remove_tempfile, NULL);
35 + atexit (remove_tempfile);
37 /* Create the ELF file data for the output file. */
38 Elf *elf = ld_state.outelf = elf_begin (fd,
40 struct id_list search;
42 bool result = ld_state.default_bind_local;
45 if (XELF_ST_BIND (sym->st_info) == STB_LOCAL || sym->st_shndx == SHN_UNDEF)
46 /* We don't have to do anything to local symbols here. */
47 @@ -3367,7 +3374,12 @@
48 version = strchr (str, VER_CHR);
51 - search.id = strndupa (str, version - str);
52 + substr_len = version - str;
53 + char* tmp = alloca(substr_len+1);
54 + strncpy(tmp, str, substr_len);
55 + tmp[substr_len] = 0;
58 if (*++version == VER_CHR)
59 /* Skip the second '@' signaling a default definition. */