diff options
Diffstat (limited to 'canohost.c')
-rw-r--r-- | canohost.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/canohost.c b/canohost.c index 8f4bebda2..d47940b1b 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: canohost.c,v 1.21 2001/02/08 19:30:51 itojun Exp $"); | 15 | RCSID("$OpenBSD: canohost.c,v 1.22 2001/02/08 22:37:10 markus Exp $"); |
16 | 16 | ||
17 | #include "packet.h" | 17 | #include "packet.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -142,10 +142,10 @@ get_remote_hostname(int socket, int reverse_mapping_check) | |||
142 | void | 142 | void |
143 | check_ip_options(int socket, char *ipaddr) | 143 | check_ip_options(int socket, char *ipaddr) |
144 | { | 144 | { |
145 | u_char options[200], *ucp; | 145 | u_char options[200]; |
146 | char text[1024], *cp; | 146 | char text[sizeof(options) * 3 + 1]; |
147 | socklen_t option_size; | 147 | socklen_t option_size; |
148 | int ipproto; | 148 | int i, ipproto; |
149 | struct protoent *ip; | 149 | struct protoent *ip; |
150 | 150 | ||
151 | if ((ip = getprotobyname("ip")) != NULL) | 151 | if ((ip = getprotobyname("ip")) != NULL) |
@@ -155,10 +155,10 @@ check_ip_options(int socket, char *ipaddr) | |||
155 | option_size = sizeof(options); | 155 | option_size = sizeof(options); |
156 | if (getsockopt(socket, ipproto, IP_OPTIONS, (void *)options, | 156 | if (getsockopt(socket, ipproto, IP_OPTIONS, (void *)options, |
157 | &option_size) >= 0 && option_size != 0) { | 157 | &option_size) >= 0 && option_size != 0) { |
158 | cp = text; | 158 | text[0] = '\0'; |
159 | /* Note: "text" buffer must be at least 3x as big as options. */ | 159 | for (i = 0; i < option_size; i++) |
160 | for (ucp = options; option_size > 0; ucp++, option_size--, cp += 3) | 160 | snprintf(text + i*3, sizeof(text) - i*3, |
161 | sprintf(cp, " %2.2x", *ucp); | 161 | " %2.2x", options[i]); |
162 | log("Connection from %.100s with IP options:%.800s", | 162 | log("Connection from %.100s with IP options:%.800s", |
163 | ipaddr, text); | 163 | ipaddr, text); |
164 | packet_disconnect("Connection from %.100s with IP options:%.800s", | 164 | packet_disconnect("Connection from %.100s with IP options:%.800s", |