summaryrefslogtreecommitdiff
path: root/elfcopy/binary.c
diff options
context:
space:
mode:
Diffstat (limited to 'elfcopy/binary.c')
-rw-r--r--elfcopy/binary.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/elfcopy/binary.c b/elfcopy/binary.c
index 7c834a9aaa34d..ad86a6533c55a 100644
--- a/elfcopy/binary.c
+++ b/elfcopy/binary.c
@@ -26,6 +26,7 @@
#include <sys/param.h>
#include <sys/stat.h>
+#include <ctype.h>
#include <err.h>
#include <gelf.h>
#include <stdio.h>
@@ -35,7 +36,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: binary.c 3270 2015-12-11 18:48:56Z emaste $");
+ELFTC_VCSID("$Id: binary.c 3445 2016-04-20 19:08:30Z emaste $");
/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
@@ -213,9 +214,9 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, const char *ifn)
if ((sym_basename = strdup(ifn)) == NULL)
err(1, "strdup");
- p = sym_basename;
- while ((p = strchr(p, '.')) != NULL)
- *p++ = '_';
+ for (p = sym_basename; *p != '\0'; p++)
+ if (!isalnum(*p))
+ *p = '_';
#define _GEN_SYMNAME(S) do { \
snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \
} while (0)