Don't let pad function make over-long strings.

This commit is contained in:
Dianne Skoll
2022-03-25 11:08:43 -04:00
parent 71c11672c2
commit 9488e7ca13

View File

@@ -1040,6 +1040,10 @@ static int FPad(func_info *info)
return E_BAD_TYPE;
}
if (MaxStringLen > 0 && wantlen > (size_t) MaxStringLen) {
return E_STRING_TOO_LONG;
}
DBufInit(&dbuf);
s = ARGSTR(1);
if (Nargs < 4 || !ARGV(3)) {