diff options
-rw-r--r-- | stegmp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -232,7 +232,9 @@ static int stegmp_parse_headers(const unsigned char *addr, size_t orig_size, bmpp->data_offset = packed_header.data_offset; bmpp->size = packed_header.bmp_size; - stegmp_parse_dib_header(addr + sizeof(packed_header), orig_size, bmpp); + if (stegmp_parse_dib_header(addr + sizeof(packed_header), orig_size, bmpp) < 0) { + return -1; + } return 0; } @@ -246,6 +248,7 @@ static int stegmp(const char *bmp_file, FILE *input) struct stat stat; struct bitmap bmp; FILE *fh = fopen(bmp_file, "r+"); + int ret = 0; if (fh == NULL) { fprintf(stderr, "%s: %m\n", bmp_file); @@ -273,12 +276,13 @@ static int stegmp(const char *bmp_file, FILE *input) } else { fprintf(stderr, "unable to parse headers: %s\n", bmp_strerror(bmp_errno)); + ret = -1; } munmap(addr, stat.st_size); fclose(fh); - return 0; + return ret; } static inline int stegmp_read(const char *bmp_file) |