ref: c7777847daa2ad2d75f13f383f4fa7b794cd79e4
parent: 47b45ecfc357fa61be133e776d3d84f8f9d0b152
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Oct 16 05:58:14 EDT 2023
PR_Str: a bit more robust checks
--- a/pr_edict.c
+++ b/pr_edict.c
@@ -98,9 +98,9 @@
char *
PR_Str(int i)
{
- if(i >= 0)
+ if(i >= 0 && i < pr_strings_size)
return pr_strings+i;
- if(i < 0 && i >= -num_prstr)
+ if(i < 0 && i >= -num_prstr && prstr[-1-i] != nil)
return prstr[-1-i];
Host_Error("PR_Str: invalid offset %d", i);
return "";