lib: ensure vty buf is nul terminated and wrap puts to it with checks

* vty.c: Fix str* overruns in previous commit, which I reported to the
  author. Add bit more checking of updates to vty buffer.
  Swap VTY_BUFSIZ over to vty->max, as that should be the external API.
* vty.c: (vty_buf_assert) conditions that should always be assertable for
  vty buffer.
  (vty_buf_put) little wrapper to check char puts to vty input buffer,
  and unconditionally write nul at very end of buffer as guard.
  Won't always work, as some places use mem* to manipulate.
  (vty_self_insert{,_overwrite}) Length check needs to leave room for nul.
  Use vty_buf_put.
  (vty_insert_word_overwrite) Length check needs to leave room for nul.
  (*) Add vty_buf_assert calls.

Merging in fixes from Quentin Young <qlyoung@cumulusnetworks.com>
1 file changed