10476 file(1) could be smatch clean
492 */
493 if (Chdr.c_tag == CA_SUNW_NULL)
494 break;
495
496 (void) elfcap_tag_to_str(ELFCAP_STYLE_UC,
497 Chdr.c_tag, Chdr.c_un.c_val, capstr,
498 sizeof (capstr), ELFCAP_FMT_SNGSPACE,
499 mac);
500
501 if ((*EI->cap_str != '\0') && (*capstr != '\0'))
502 (void) strlcat(EI->cap_str, " ",
503 sizeof (EI->cap_str));
504
505 (void) strlcat(EI->cap_str, capstr,
506 sizeof (EI->cap_str));
507 }
508 } else if (shdr->sh_type == SHT_DYNAMIC) {
509 Elf_Dyn dyn;
510 FILE_ELF_SIZE_T dsize;
511 FILE_ELF_OFF_T doff;
512 int dynn;
513
514 doff = shdr->sh_offset;
515 dsize = sizeof (Elf_Dyn);
516
517 if (shdr->sh_size == 0 || shdr->sh_entsize == 0) {
518 (void) fprintf(stderr, ELF_ERR_DYNAMIC1,
519 File, EI->file);
520 return (ELF_READ_FAIL);
521 }
522
523 dynn = (shdr->sh_size / shdr->sh_entsize);
524 for (j = 0; j < dynn; j++) {
525 if (pread64(EI->elffd, &dyn, dsize, doff)
526 != dsize ||
527 file_xlatetom(ELF_T_DYN, (char *)&dyn)
528 == 0) {
529 (void) fprintf(stderr, ELF_ERR_DYNAMIC2,
530 File, EI->file);
531 return (ELF_READ_FAIL);
532 }
|
492 */
493 if (Chdr.c_tag == CA_SUNW_NULL)
494 break;
495
496 (void) elfcap_tag_to_str(ELFCAP_STYLE_UC,
497 Chdr.c_tag, Chdr.c_un.c_val, capstr,
498 sizeof (capstr), ELFCAP_FMT_SNGSPACE,
499 mac);
500
501 if ((*EI->cap_str != '\0') && (*capstr != '\0'))
502 (void) strlcat(EI->cap_str, " ",
503 sizeof (EI->cap_str));
504
505 (void) strlcat(EI->cap_str, capstr,
506 sizeof (EI->cap_str));
507 }
508 } else if (shdr->sh_type == SHT_DYNAMIC) {
509 Elf_Dyn dyn;
510 FILE_ELF_SIZE_T dsize;
511 FILE_ELF_OFF_T doff;
512 uint64_t dynn;
513
514 doff = shdr->sh_offset;
515 dsize = sizeof (Elf_Dyn);
516
517 if (shdr->sh_size == 0 || shdr->sh_entsize == 0) {
518 (void) fprintf(stderr, ELF_ERR_DYNAMIC1,
519 File, EI->file);
520 return (ELF_READ_FAIL);
521 }
522
523 dynn = (shdr->sh_size / shdr->sh_entsize);
524 for (j = 0; j < dynn; j++) {
525 if (pread64(EI->elffd, &dyn, dsize, doff)
526 != dsize ||
527 file_xlatetom(ELF_T_DYN, (char *)&dyn)
528 == 0) {
529 (void) fprintf(stderr, ELF_ERR_DYNAMIC2,
530 File, EI->file);
531 return (ELF_READ_FAIL);
532 }
|