summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2021-05-01 21:06:37 +0200
committerPali Rohár <pali.rohar@gmail.com>2021-05-01 21:06:37 +0200
commit5c0720da32ff6896fd862a26c9ad51b1d4ee7981 (patch)
tree418feb1f53584997cd1931ba121b51b3faccd749
parent374fd1be01c8d48ee36f8c550135498daf85bcbf (diff)
download0xFFFF-5c0720da32ff6896fd862a26c9ad51b1d4ee7981.tar.bz2
local: Fix reading kernel size when dumping image
-rw-r--r--src/local.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/local.c b/src/local.c
index 732f4fe..3e39a75 100644
--- a/src/local.c
+++ b/src/local.c
@@ -466,8 +466,9 @@ int local_dump_image(enum image_type image, const char * file) {
fd = open(file, O_RDONLY);
if ( fd >= 0 ) {
if ( read(fd, buf, 20) == 20 && memcmp(buf, "NOLO!img\x02\x00\x00\x00\x00\x00\x00\x00", 16) == 0 )
- nlen = (buf[16] << 0) | (buf[17] << 8) | (buf[18] << 16) | (buf[19] << 24);
+ nlen = ((unsigned int)buf[16] << 0) | ((unsigned int)buf[17] << 8) | ((unsigned int)buf[18] << 16) | ((unsigned int)buf[19] << 24);
close(fd);
+ fd = -1;
}
unlink(file);