diff options
-rw-r--r-- | tools/ideviceimagemounter.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 52b0666..511583e 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c | |||
@@ -377,8 +377,11 @@ int main(int argc, char **argv) | |||
377 | fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno)); | 377 | fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno)); |
378 | goto leave; | 378 | goto leave; |
379 | } | 379 | } |
380 | fstat(fileno(f), &fst); | 380 | if (fstat(fileno(f), &fst) != 0) { |
381 | sig = malloc(sig_length); | 381 | fprintf(stderr, "Error: fstat: %s\n", strerror(errno)); |
382 | goto leave; | ||
383 | } | ||
384 | sig = malloc(fst.st_size); | ||
382 | sig_length = fread(sig, 1, fst.st_size, f); | 385 | sig_length = fread(sig, 1, fst.st_size, f); |
383 | fclose(f); | 386 | fclose(f); |
384 | if (sig_length == 0) { | 387 | if (sig_length == 0) { |