mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +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);
|
lseek (fd, 0, SEEK_SET);
|
||||||
}
|
}
|
||||||
if (*zip) {
|
if (*zip) {
|
||||||
|
int r;
|
||||||
|
|
||||||
lseek (fd, offs, SEEK_SET);
|
lseek (fd, offs, SEEK_SET);
|
||||||
read (fd, id, 2);
|
r = read (fd, id, 2);
|
||||||
if (id[0] == 0x1f && id[1] == 0x8b) {
|
if (r == 2 && id[0] == 0x1f && id[1] == 0x8b && len >= 6) {
|
||||||
lseek (fd, offs + len - 4, SEEK_SET);
|
lseek (fd, offs + len - 4, SEEK_SET);
|
||||||
read (fd, len_bytes, 4);
|
read (fd, len_bytes, 4);
|
||||||
len = ((len_bytes[3] << 24)
|
len = ((len_bytes[3] << 24)
|
||||||
|
|
Loading…
Reference in a new issue