Page MenuHomeFreeBSD

D2314.diff
No OneTemporary

D2314.diff

Index: usr.sbin/crunch/crunchide/Makefile
===================================================================
--- usr.sbin/crunch/crunchide/Makefile
+++ usr.sbin/crunch/crunchide/Makefile
@@ -1,19 +1,9 @@
# $FreeBSD$
PROG= crunchide
-SRCS= crunchide.c
+SRCS= crunchide.c exec_elf32.c exec_elf64.c
-TARGET_ARCH?= ${MACHINE_ARCH}
-
-.if ${TARGET_ARCH} == aarch64 || ${TARGET_ARCH} == amd64 || \
- ${TARGET_ARCH} == powerpc64 || \
- ${TARGET_ARCH} == sparc64 || ${TARGET_ARCH:Mmips64*}
-CFLAGS+=-DNLIST_ELF64
-SRCS+= exec_elf64.c
+CFLAGS+=-DNLIST_ELF32 -DNLIST_ELF64
exec_elf64.o: exec_elf32.c
-.else
-CFLAGS+=-DNLIST_ELF32
-SRCS+= exec_elf32.c
-.endif
.include <bsd.prog.mk>
Index: usr.sbin/crunch/crunchide/exec_elf32.c
===================================================================
--- usr.sbin/crunch/crunchide/exec_elf32.c
+++ usr.sbin/crunch/crunchide/exec_elf32.c
@@ -79,6 +79,9 @@
#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
+#ifndef ELFCLASS
+#define ELFCLASS CONCAT(ELFCLASS,ELFSIZE)
+#endif
#define xe16toh(x) ((data == ELFDATA2MSB) ? be16toh(x) : le16toh(x))
#define xe32toh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x))
@@ -167,7 +170,7 @@
if (read(fd, &eh, sizeof eh) != sizeof eh)
return 0;
- if (IS_ELF(eh) == 0)
+ if (IS_ELF(eh) == 0 || eh.e_ident[EI_CLASS] != ELFCLASS)
return 0;
data = eh.e_ident[EI_DATA];

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 14, 10:17 AM (14 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31467734
Default Alt Text
D2314.diff (1 KB)

Event Timeline