mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
handle short files more robustly
This commit is contained in:
parent
7052a6f20b
commit
39886ebb18
1 changed files with 4 additions and 2 deletions
|
@ -156,9 +156,11 @@ check_file (int fd, int offs, int len, int *zip)
|
|||
lseek (fd, 0, SEEK_SET);
|
||||
}
|
||||
if (*zip) {
|
||||
int r;
|
||||
|
||||
lseek (fd, offs, SEEK_SET);
|
||||
read (fd, id, 2);
|
||||
if (id[0] == 0x1f && id[1] == 0x8b) {
|
||||
r = read (fd, id, 2);
|
||||
if (r == 2 && id[0] == 0x1f && id[1] == 0x8b && len >= 6) {
|
||||
lseek (fd, offs + len - 4, SEEK_SET);
|
||||
read (fd, len_bytes, 4);
|
||||
len = ((len_bytes[3] << 24)
|
||||
|
|
Loading…
Reference in a new issue