]> granicus.if.org Git - file/commitdiff
Code to detect gnu attributes, and start of parser.
authorChristos Zoulas <christos@zoulas.com>
Fri, 2 May 2014 02:25:10 +0000 (02:25 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 2 May 2014 02:25:10 +0000 (02:25 +0000)
src/readelf.c

index b35bad29df88211271e554ecdafb6c868811bb48..08f81f5b8ab678274b180ae751d49160708b2228 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.101 2014/03/11 17:13:18 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.102 2014/03/11 21:00:13 christos Exp $")
 #endif
 
 #ifdef BUILTIN_ELF
@@ -1005,6 +1005,36 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
                                        file_badread(ms);
                                        return -1;
                                }
+                               if (cbuf[0] == 'A') {
+#ifdef notyet
+                                       char *p = cbuf + 1;
+                                       uint32_t len, tag;
+                                       memcpy(&len, p, sizeof(len));
+                                       p += 4;
+                                       len = getu32(swap, len);
+                                       if (memcmp("gnu", p, 3) != 0) {
+                                           if (file_printf(ms,
+                                               ", unknown capability %.3s", p)
+                                               == -1)
+                                               return -1;
+                                           break;
+                                       }
+                                       p += strlen(p) + 1;
+                                       tag = *p++;
+                                       memcpy(&len, p, sizeof(len));
+                                       p += 4;
+                                       len = getu32(swap, len);
+                                       if (tag != 1) {
+                                           if (file_printf(ms, ", unknown gnu"
+                                               " capability tag %d", tag)
+                                               == -1)
+                                               return -1;
+                                           break;
+                                       }
+                                       // gnu attributes 
+#endif
+                                       break;
+                               }
                                (void)memcpy(xcap_addr, cbuf, xcap_sizeof);
                                switch (xcap_tag) {
                                case CA_SUNW_NULL: