No trailing zeros if the signed boot img is larger

This commit is contained in:
LoveSy 2023-09-12 11:08:46 +08:00 committed by John Wu
parent 0a2a590ab7
commit 0243610c09

View File

@ -876,8 +876,10 @@ int sign(const char *image, const char *name, const char *cert, const char *key)
close(fd);
return 1;
}
// Wipe out rest of tail
write_zero(fd, boot.map.sz() - lseek(fd, 0, SEEK_CUR));
if (auto off = lseek(fd, 0, SEEK_CUR); off < boot.map.sz()) {
// Wipe out rest of tail
write_zero(fd, boot.map.sz() - off);
}
close(fd);
return 0;
}