telnet.c: fix possible use of uninitialized variable
telnet.c: check sscanf results before passing them to snprintf