Correct the size adjustment for qwe's newstr.

It seems the correct interpretation is that the size parameter includes the
trailing 0 (going by mvdsv source).
This commit is contained in:
Bill Currie 2012-07-06 10:53:24 +09:00
parent d4f4e450e6
commit 20ad50407d

View file

@ -254,7 +254,7 @@ PF_newstr (progs_t *pr)
if (pr->pr_argc > 1 && P_FLOAT (pr, 1) > dstr->size) { if (pr->pr_argc > 1 && P_FLOAT (pr, 1) > dstr->size) {
int s = dstr->size; int s = dstr->size;
dstr->size = P_FLOAT (pr, 1) + 1; dstr->size = P_FLOAT (pr, 1);
dstring_adjust (dstr); dstring_adjust (dstr);
memset (dstr->str + s, 0, dstr->size - s); memset (dstr->str + s, 0, dstr->size - s);
} }