set upper limit for REP escape sequence argument

Previously, printf 'L\033[2147483647b' would call tputc('L') 2^31 times,
making st unresponsive. This commit allows repeating the last character
at most 65535 times in order to prevent freezing and DoS attacks.
This commit is contained in:
Internal Server Error - Gitea: Git with a cup of tea and freedom
500 Internal Server Error

Gitea Version: 1.28.0+dev-505-g31b4d79a84