summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/channels.c b/channels.c
index 5796a8bb9..cd68efded 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.251 2006/07/03 17:59:32 stevesk Exp $ */ 1/* $OpenBSD: channels.c,v 1.252 2006/07/10 12:08:08 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1014,7 +1014,7 @@ channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset)
1014 } s5_req, s5_rsp; 1014 } s5_req, s5_rsp;
1015 u_int16_t dest_port; 1015 u_int16_t dest_port;
1016 u_char *p, dest_addr[255+1]; 1016 u_char *p, dest_addr[255+1];
1017 u_int have, i, found, nmethods, addrlen, af; 1017 u_int have, need, i, found, nmethods, addrlen, af;
1018 1018
1019 debug2("channel %d: decode socks5", c->self); 1019 debug2("channel %d: decode socks5", c->self);
1020 p = buffer_ptr(&c->input); 1020 p = buffer_ptr(&c->input);
@@ -1075,7 +1075,10 @@ channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset)
1075 debug2("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp); 1075 debug2("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp);
1076 return -1; 1076 return -1;
1077 } 1077 }
1078 if (have < 4 + addrlen + 2) 1078 need = sizeof(s5_req) + addrlen + 2;
1079 if (s5_req.atyp == SSH_SOCKS5_DOMAIN)
1080 need++;
1081 if (have < need)
1079 return 0; 1082 return 0;
1080 buffer_consume(&c->input, sizeof(s5_req)); 1083 buffer_consume(&c->input, sizeof(s5_req));
1081 if (s5_req.atyp == SSH_SOCKS5_DOMAIN) 1084 if (s5_req.atyp == SSH_SOCKS5_DOMAIN)