mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
Bug 506207 - Check the return value of fread to make sure the readed data is valid; r,a=joe
This commit is contained in:
parent
2eb4b96e6c
commit
76b8dd5301
@ -786,9 +786,11 @@ qcms_profile* qcms_profile_from_file(FILE *file)
|
||||
be32 length_be;
|
||||
void *data;
|
||||
|
||||
fread(&length_be, sizeof(length), 1, file);
|
||||
if (fread(&length_be, 1, sizeof(length_be), file) != sizeof(length_be))
|
||||
return BAD_VALUE_PROFILE;
|
||||
|
||||
length = be32_to_cpu(length_be);
|
||||
if (length > MAX_PROFILE_SIZE)
|
||||
if (length > MAX_PROFILE_SIZE || length < sizeof(length_be))
|
||||
return BAD_VALUE_PROFILE;
|
||||
|
||||
/* allocate room for the entire profile */
|
||||
|
Loading…
x
Reference in New Issue
Block a user