[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:
Bill Currie 2024-08-29 01:04:52 +09:00
parent b302ce1095
commit daaaeb9aed

View file

@ -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);