summaryrefslogtreecommitdiff
blob: 400f313edeeb79e578fb9c9dafa803fa598df5c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- upx-1.25.orig/src/p_unix.cpp	2005-06-03 13:00:09.000000000 -0400
+++ upx-1.25/src/p_unix.cpp	2005-06-03 13:51:24.000000000 -0400
@@ -376,11 +376,12 @@ bool PackLinuxI386::canPack()
     const unsigned l = get_le32(buf);
     if (!memcmp(buf, "\x7f\x45\x4c\x46\x01\x01\x01", 7)) // ELF 32-bit LSB
     {
+        unsigned int e_type = get_le16(buf+16);
         exetype = 1;
         // now check the ELF header
         if (memcmp(buf+8, "FreeBSD", 7) == 0)   // branded
             exetype = 0;
-        if (get_le16(buf+16) != 2)              // e_type - executable
+        if ((e_type > 3) || (e_type < 2))       // e_type - ET_EXEC or ET_DYN
             exetype = 0;
         if (get_le16(buf+18) != 3)              // e_machine - Intel 80386
             exetype = 0;