File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/client/legacy/connect/proxy/socks/v5 Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ impl TryFrom<&mut BytesMut> for ProxyRes {
172172 type Error = ParsingError ;
173173
174174 fn try_from ( buf : & mut BytesMut ) -> Result < Self , ParsingError > {
175- if buf. remaining ( ) < 2 {
175+ if buf. remaining ( ) < 3 {
176176 return Err ( ParsingError :: Incomplete ) ;
177177 }
178178
@@ -248,6 +248,7 @@ impl TryFrom<&mut BytesMut> for Address {
248248 }
249249
250250 Ok ( match buf. get_u8 ( ) {
251+ // IPv4
251252 0x01 => {
252253 let mut ip = [ 0 ; 4 ] ;
253254
@@ -260,7 +261,7 @@ impl TryFrom<&mut BytesMut> for Address {
260261
261262 Self :: Socket ( SocketAddr :: new ( ip. into ( ) , port) )
262263 }
263-
264+ // Domain
264265 0x03 => {
265266 let len = buf. get_u8 ( ) ;
266267
@@ -278,11 +279,11 @@ impl TryFrom<&mut BytesMut> for Address {
278279
279280 Self :: Domain ( domain, port)
280281 }
281-
282+ // IPv6
282283 0x04 => {
283284 let mut ip = [ 0 ; 16 ] ;
284285
285- if buf. remaining ( ) < 6 {
286+ if buf. remaining ( ) < 18 {
286287 return Err ( ParsingError :: Incomplete ) ;
287288 }
288289 buf. copy_to_slice ( & mut ip) ;
You can’t perform that action at this time.
0 commit comments