readline: Fix buffer overrun on re-add to history