diff options
Diffstat (limited to 'util/ifdtool')
-rw-r--r-- | util/ifdtool/ifdtool.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 1b418d10b8..1a8bf85059 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -397,6 +397,12 @@ void inject_region(char *filename, char *image, int size, int region_type, memset(image + region.base, 0xff, offset); } + if (size < region.base + offset + region_size) { + fprintf(stderr, "Output file is too small. (%d < %d)\n", + size, region.base + offset + region_size); + exit(EXIT_FAILURE); + } + if (read(region_fd, image + region.base + offset, region_size) != region_size) { perror("Could not read file"); |