1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 04:22:47 -05:00

Robustness fixes for KEXINIT handling and others. In particular, I've

created a self-mallocing variant of sprintf, to obviate any future
need for paranoid %.100s type stuff in format strings.

[originally from svn r2199]
This commit is contained in:
Simon Tatham
2002-11-07 19:49:03 +00:00
parent 7a85e73e57
commit 7c95ea19c8
11 changed files with 306 additions and 247 deletions

10
raw.c
View File

@ -90,9 +90,10 @@ static char *raw_init(void *frontend_handle, void **backend_handle,
* Try to find host.
*/
{
char buf[200];
sprintf(buf, "Looking up host \"%.170s\"", host);
char *buf;
buf = dupprintf("Looking up host \"%s\"", host);
logevent(raw->frontend, buf);
sfree(buf);
}
addr = sk_namelookup(host, realhost);
if ((err = sk_addr_error(addr)))
@ -105,10 +106,11 @@ static char *raw_init(void *frontend_handle, void **backend_handle,
* Open socket.
*/
{
char buf[200], addrbuf[100];
char *buf, addrbuf[100];
sk_getaddr(addr, addrbuf, 100);
sprintf(buf, "Connecting to %.100s port %d", addrbuf, port);
buf = dupprintf("Connecting to %s port %d", addrbuf, port);
logevent(raw->frontend, buf);
sfree(buf);
}
raw->s = new_connection(addr, *realhost, port, 0, 1, nodelay, (Plug) raw);
if ((err = sk_socket_error(raw->s)))