mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +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;
|
s += start;
|
||||||
l -= start;
|
l -= start;
|
||||||
|
|
||||||
if (len > l + 1)
|
if (len > l)
|
||||||
len = l + 1;
|
len = l;
|
||||||
|
|
||||||
tmp = Hunk_TempAlloc (len);
|
tmp = Hunk_TempAlloc (len + 1);
|
||||||
strncpy (tmp, s, len - 1);
|
strncpy (tmp, s, len);
|
||||||
tmp[len - 1] = 0;
|
tmp[len] = 0;
|
||||||
|
|
||||||
RETURN_STRING (pr, tmp);
|
RETURN_STRING (pr, tmp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue