Fixed buffer overrun in load_palette_raw

This commit is contained in:
Casey 2022-02-05 20:23:24 +03:00
parent 21e7310ae1
commit 10d377c6c8
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ bool load_palette_gpl(palette_t *pal, FILE *fp)
bool load_palette_raw(palette_t *pal, FILE *fp)
{
while (!feof(fp))
while (!feof(fp) && pal->n_colors < 256)
{
size_t sz = fread(&pal->palette[pal->n_colors++], 1, sizeof(rgba8), fp);
if (sz == 0 && feof(fp)) break;