]> granicus.if.org Git - file/commitdiff
elf capabilities fix (Jan Kaluza)
authorChristos Zoulas <christos@zoulas.com>
Thu, 13 Dec 2012 13:48:31 +0000 (13:48 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 13 Dec 2012 13:48:31 +0000 (13:48 +0000)
ChangeLog
src/readelf.c

index c7ac6158c2d6c0ed74c385f6a4d58f039b1681f7..157d07c1ffa558b450c37c0b50e2de8bf884db3a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-12-19   8:47  Christos Zoulas <christos@zoulas.com>
+
+       * Only print elf capabilities for archs we know (Jan Kaluza)
+
 2012-10-30  19:14  Christos Zoulas <christos@zoulas.com>
 
        * Add "name" and "use" file types in order to look
index 158f789bda1a17af1fb7cfd11a80c19035b787a0..8212330d6b1d09c1b1a4aa4e1ae6a9a80a3c79a9 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.92 2012/06/20 22:33:43 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.93 2012/10/31 17:03:41 christos Exp $")
 #endif
 
 #ifdef BUILTIN_ELF
@@ -928,6 +928,17 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
                        free(nbuf);
                        break;
                case SHT_SUNW_cap:
+                       switch (mach) {
+                       case EM_SPARC:
+                       case EM_SPARCV9:
+                       case EM_IA_64:
+                       case EM_386:
+                       case EM_AMD64:
+                               break;
+                       default:
+                               goto skip;
+                       }
+
                        if (lseek(fd, (off_t)xsh_offset, SEEK_SET) ==
                            (off_t)-1) {
                                file_badseek(ms);
@@ -967,12 +978,13 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
                                        break;
                                }
                        }
-                       break;
-
+                       /*FALLTHROUGH*/
+               skip:
                default:
                        break;
                }
        }
+
        if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
                return -1;
        if (cap_hw1) {