diff --git a/src/ar.c b/src/ar.c index 3bcb18fe827b6c01c6b088c6e20b7680cf4e72e7..1a76cbc6c44df53f963fe936aaf5e454ca3bc668 100644 --- a/src/ar.c +++ b/src/ar.c @@ -494,6 +494,8 @@ do_oper_extract (int oper, const char *arfname, char **argv, int argc, while ((subelf = elf_begin (fd, cmd, elf)) != NULL) { Elf_Arhdr *arhdr = elf_getarhdr (subelf); + if (arhdr == NULL) + goto next; if (strcmp (arhdr->ar_name, "/") == 0) { @@ -939,6 +941,8 @@ do_oper_delete (const char *arfname, char **argv, int argc, while ((subelf = elf_begin (fd, cmd, elf)) != NULL) { Elf_Arhdr *arhdr = elf_getarhdr (subelf); + if (arhdr == NULL) + goto next; /* Ignore the symbol table and the long file name table here. */ if (strcmp (arhdr->ar_name, "/") == 0 @@ -1148,6 +1152,8 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, while ((subelf = elf_begin (fd, cmd, elf)) != NULL) { Elf_Arhdr *arhdr = elf_getarhdr (subelf); + if (arhdr == NULL) + goto next; /* Ignore the symbol table and the long file name table here. */ if (strcmp (arhdr->ar_name, "/") == 0