- boundscheck static progs strings, and give proper errors for that

and dynamic strings if it fails.
This commit is contained in:
Adam Olsen 2001-09-28 23:34:49 +00:00
parent f0244bece2
commit e12f1dcf9e
1 changed files with 6 additions and 1 deletions

View File

@ -202,11 +202,16 @@ PR_GetString (progs_t *pr, int num)
num = ~num % 1024;
if (row < 0 || row >= pr->dyn_str_size)
return 0;
goto bad_string_offset;
return pr->dynamic_strings[row][num].string;
} else {
if (num >= pr->pr_stringsize)
goto bad_string_offset;
return pr->pr_strings + num;
}
bad_string_offset:
PR_RunError (pr, "Invalid string offset 0x%u", num);
}
int