The available size passed to strlcpy() was computed incorrectly.
Switch to updating the length after writing to the new prompt instead
of computing it each time. The actual buffer size is computed and
allocated correctly so there is no real consequence to this bug.
Found by Qualys.