1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

CID1130011: Use after free in ich_descriptor_tool

Corresponding to flashrom svn r1771.

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Stefan Reinauer 2014-04-26 16:11:21 +00:00 committed by Stefan Tauner
parent f94d9ceaa6
commit a54169b3d1

View File

@ -77,12 +77,13 @@ static void dump_file(const char *prefix, const uint32_t *dump, unsigned int len
printf("Dumping %u bytes of the %s region from 0x%08x-0x%08x to %s... ", printf("Dumping %u bytes of the %s region from 0x%08x-0x%08x to %s... ",
file_len, region_names[i], base, limit, fn); file_len, region_names[i], base, limit, fn);
int fh = open(fn, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); int fh = open(fn, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
free(fn);
if (fh < 0) { if (fh < 0) {
fprintf(stderr, fprintf(stderr,
"ERROR: couldn't open(%s): %s\n", fn, strerror(errno)); "ERROR: couldn't open(%s): %s\n", fn, strerror(errno));
free(fn);
exit(1); exit(1);
} }
free(fn);
ret = write(fh, &dump[base >> 2], file_len); ret = write(fh, &dump[base >> 2], file_len);
if (ret != file_len) { if (ret != file_len) {