summaryrefslogtreecommitdiff
path: root/canohost.c
diff options
context:
space:
mode:
authordtucker <dtucker>2008-06-12 18:46:45 +0000
committerdtucker <dtucker>2008-06-12 18:46:45 +0000
commitee61e0eaee5eb7830ac56876c15f04e185cfaf7a (patch)
tree155f741ce401fca1762fd0c14394a215521e21ba /canohost.c
parent93e92d99368bcd8996fce8cd0f4d4cac1c3d76fd (diff)
downloadopenssh-ee61e0eaee5eb7830ac56876c15f04e185cfaf7a.tar.gz
- dtucker@cvs.openbsd.org 2008/06/12 00:03:49
[dns.c canohost.c sshconnect.c] Do not pass "0" strings as ports to getaddrinfo because the lookups can slow things down and we never use the service info anyway. bz #859, patch from YOSHIFUJI Hideaki and John Devitofranceschi. ok deraadt@ djm@ djm belives that the reason for the "0" strings is to ensure that it's not possible to call getaddrinfo with both host and port being NULL. In the case of canohost.c host is a local array. In the case of sshconnect.c, it's checked for null immediately before use. In dns.c it ultimately comes from ssh.c:main() and is guaranteed to be non-null but it's not obvious, so I added a warning message in case it is ever passed a null.
Diffstat (limited to 'canohost.c')
-rw-r--r--canohost.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/canohost.c b/canohost.c
index 8270500d..42011fd0 100644
--- a/canohost.c
+++ b/canohost.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: canohost.c,v 1.62 2007/12/27 14:22:08 dtucker Exp $ */
+/* $OpenBSD: canohost.c,v 1.63 2008/06/12 00:03:49 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -89,7 +89,7 @@ get_remote_hostname(int sock, int use_dns)
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_DGRAM; /*dummy*/
hints.ai_flags = AI_NUMERICHOST;
- if (getaddrinfo(name, "0", &hints, &ai) == 0) {
+ if (getaddrinfo(name, NULL, &hints, &ai) == 0) {
logit("Nasty PTR record \"%s\" is set up for %s, ignoring",
name, ntop);
freeaddrinfo(ai);