Fix null deref in the ELF version parser

test/bins/fuzz: null_pointer__elf_init__store_versioninfo__store_versioninfo_gnu_versym
This commit is contained in:
pancake 2020-02-20 21:34:41 +01:00
parent 6eb93dbf21
commit 0b17d35d18
1 changed files with 4 additions and 1 deletions

View File

@ -801,7 +801,10 @@ static Sdb *store_versioninfo_gnu_versym(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
goto beach;
}
const char *name = bin->strtab + vda.vda_name;
sdb_set (sdb, key, sdb_fmt ("%s(%s%-*s)", tmp_val, name, (int)(12 - strlen (name)),")") , 0);
if (name) {
const char *fname = sdb_fmt ("%s(%s%-*s)", tmp_val, name, (int)(12 - strlen (name)),")");
sdb_set (sdb, key, fname, 0);
}
}
}
}