Print this page
3299 file should only care about object capabilities
3300 file should care about all object capabilities
*** 28,39 ****
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- #pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* ELF files can exceed 2GB in size. A standard 32-bit program
* like 'file' cannot read past 2GB, and will be unable to see
* the ELF section headers that typically are at the end of the
* object. The simplest solution to this problem would be to make
--- 28,37 ----
*** 456,465 ****
--- 454,465 ----
continue;
}
cap_off = shdr->sh_offset;
if (shdr->sh_type == SHT_SUNW_cap) {
+ char capstr[128];
+
if (shdr->sh_size == 0 || shdr->sh_entsize == 0) {
(void) fprintf(stderr, ELF_ERR_ELFCAP1,
File, EI->file);
return (ELF_READ_FAIL);
}
*** 475,492 ****
(void) fprintf(stderr, ELF_ERR_ELFCAP2,
File, EI->file);
return (ELF_READ_FAIL);
}
- if (Chdr.c_tag != CA_SUNW_NULL) {
- (void) elfcap_tag_to_str(
- ELFCAP_STYLE_UC, Chdr.c_tag,
- Chdr.c_un.c_val, EI->cap_str,
- sizeof (EI->cap_str),
- ELFCAP_FMT_SNGSPACE, mac);
- }
cap_off += csize;
}
}
/*
* Definition time:
--- 475,506 ----
(void) fprintf(stderr, ELF_ERR_ELFCAP2,
File, EI->file);
return (ELF_READ_FAIL);
}
cap_off += csize;
+
+ /*
+ * Each capatibility group is terminated with
+ * CA_SUNW_NULL. Groups other than the first
+ * represent symbol capabilities, and aren't
+ * interesting here.
+ */
+ if (Chdr.c_tag == CA_SUNW_NULL)
+ break;
+
+ (void) elfcap_tag_to_str(ELFCAP_STYLE_UC,
+ Chdr.c_tag, Chdr.c_un.c_val, capstr,
+ sizeof (capstr), ELFCAP_FMT_SNGSPACE,
+ mac);
+
+ if ((*EI->cap_str != '\0') && (*capstr != '\0'))
+ (void) strlcat(EI->cap_str, " ",
+ sizeof (EI->cap_str));
+
+ (void) strlcat(EI->cap_str, capstr,
+ sizeof (EI->cap_str));
}
}
/*
* Definition time: