mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
Fix an off-by-one error in qwe's substr implementation.
This commit is contained in:
parent
fcf7150c62
commit
45311e55c2
1 changed files with 5 additions and 5 deletions
|
@ -171,12 +171,12 @@ PF_substr (progs_t *pr)
|
|||
s += start;
|
||||
l -= start;
|
||||
|
||||
if (len > l + 1)
|
||||
len = l + 1;
|
||||
if (len > l)
|
||||
len = l;
|
||||
|
||||
tmp = Hunk_TempAlloc (len);
|
||||
strncpy (tmp, s, len - 1);
|
||||
tmp[len - 1] = 0;
|
||||
tmp = Hunk_TempAlloc (len + 1);
|
||||
strncpy (tmp, s, len);
|
||||
tmp[len] = 0;
|
||||
|
||||
RETURN_STRING (pr, tmp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue