!36 fix bug of null pointer

Merge pull request !36 from 王志康/master
This commit is contained in:
openharmony_ci
2025-05-08 03:06:34 +00:00
committed by Gitee
+6
View File
@@ -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