summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jffsX-utils/jffs2dump.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/jffsX-utils/jffs2dump.c b/jffsX-utils/jffs2dump.c
index d30b59f..30455ea 100644
--- a/jffsX-utils/jffs2dump.c
+++ b/jffsX-utils/jffs2dump.c
@@ -757,6 +757,12 @@ int main(int argc, char **argv)
// get image length
imglen = lseek(fd, 0, SEEK_END);
+ if (imglen < 0) {
+ perror(img);
+ close(fd);
+ exit(EXIT_FAILURE);
+ }
+
lseek (fd, 0, SEEK_SET);
data = malloc (imglen);