local: Fix reading kernel size when dumping image

This commit is contained in:
Pali Rohár committed 2021-05-01 21:06:37 +02:00
1 parent 374fd1be01
commit 5c0720da32
1 file changed
+2 -1
+2 -1
View File
@@ -466,8 +466,9 @@ int local_dump_image(enum image_type image, const char * file) {
fd = open(file, O_RDONLY); fd = open(file, O_RDONLY);
if ( fd >= 0 ) { if ( fd >= 0 ) {
if ( read(fd, buf, 20) == 20 && memcmp(buf, "NOLO!img\x02\x00\x00\x00\x00\x00\x00\x00", 16) == 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); close(fd);
fd = -1;
} }
unlink(file); unlink(file);