[Bug 910] known_hosts port numbers

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Sat May 21 09:38:58 EST 2005


http://bugzilla.mindrot.org/show_bug.cgi?id=910





------- Additional Comments From djm at mindrot.org  2005-05-21 09:38 -------
(From update of attachment 914)
>Index: sshconnect.c
>===================================================================
>RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/sshconnect.c,v
>retrieving revision 1.129
>diff -u -p -r1.129 sshconnect.c
>--- sshconnect.c	14 Mar 2005 12:08:12 -0000	1.129
>+++ sshconnect.c	14 May 2005 12:13:10 -0000
...
>+		if (snprintf(hoststr, len, "%s@%hu", host, port) >= len)
>+			fatal("check_host_key: snprintf failed");
>+		len = strlen(ip) + sizeof(port) * 4 + 2;
>+		ipstr = xmalloc(len);
>+		if (snprintf(ipstr, len, "%s@%hu", ip, port) >= len)
>+			fatal("check_host_key: snprintf failed");

Current style is to check snprintf's return != -1 and < len because of old
busted implementations that return -1. I think our snprintf returns >= len on
truncation, but we should set a good example anyway.

Otherwise this looks pretty much OK. 




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.




More information about the openssh-bugs mailing list