mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Abort qfo loading if file is too small
Or really, if Qfilesize thinks it's too small. Trying to allocate -1 bytes (due to trying to open / as a qfo) didn't end well.
This commit is contained in:
parent
b302ce1095
commit
daaaeb9aed
1 changed files with 4 additions and 0 deletions
|
@ -560,6 +560,10 @@ qfo_read (QFile *file)
|
|||
unsigned i;
|
||||
|
||||
size = Qfilesize (file);
|
||||
if (size < (int) sizeof (qfo_header_t)) {
|
||||
fprintf (stderr, "not a valid qfo file\n");
|
||||
return 0;
|
||||
}
|
||||
data = malloc (size);
|
||||
Qread (file, data, size);
|
||||
|
||||
|
|
Loading…
Reference in a new issue