mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
- boundscheck static progs strings, and give proper errors for that
and dynamic strings if it fails.
This commit is contained in:
parent
f0244bece2
commit
e12f1dcf9e
1 changed files with 6 additions and 1 deletions
|
@ -202,11 +202,16 @@ PR_GetString (progs_t *pr, int num)
|
||||||
num = ~num % 1024;
|
num = ~num % 1024;
|
||||||
|
|
||||||
if (row < 0 || row >= pr->dyn_str_size)
|
if (row < 0 || row >= pr->dyn_str_size)
|
||||||
return 0;
|
goto bad_string_offset;
|
||||||
return pr->dynamic_strings[row][num].string;
|
return pr->dynamic_strings[row][num].string;
|
||||||
} else {
|
} else {
|
||||||
|
if (num >= pr->pr_stringsize)
|
||||||
|
goto bad_string_offset;
|
||||||
return pr->pr_strings + num;
|
return pr->pr_strings + num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bad_string_offset:
|
||||||
|
PR_RunError (pr, "Invalid string offset 0x%u", num);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue