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 {
172
172
type Error = ParsingError ;
173
173
174
174
fn try_from ( buf : & mut BytesMut ) -> Result < Self , ParsingError > {
175
- if buf. remaining ( ) < 2 {
175
+ if buf. remaining ( ) < 3 {
176
176
return Err ( ParsingError :: Incomplete ) ;
177
177
}
178
178
@@ -248,6 +248,7 @@ impl TryFrom<&mut BytesMut> for Address {
248
248
}
249
249
250
250
Ok ( match buf. get_u8 ( ) {
251
+ // IPv4
251
252
0x01 => {
252
253
let mut ip = [ 0 ; 4 ] ;
253
254
@@ -260,7 +261,7 @@ impl TryFrom<&mut BytesMut> for Address {
260
261
261
262
Self :: Socket ( SocketAddr :: new ( ip. into ( ) , port) )
262
263
}
263
-
264
+ // Domain
264
265
0x03 => {
265
266
let len = buf. get_u8 ( ) ;
266
267
@@ -278,11 +279,11 @@ impl TryFrom<&mut BytesMut> for Address {
278
279
279
280
Self :: Domain ( domain, port)
280
281
}
281
-
282
+ // IPv6
282
283
0x04 => {
283
284
let mut ip = [ 0 ; 16 ] ;
284
285
285
- if buf. remaining ( ) < 6 {
286
+ if buf. remaining ( ) < 18 {
286
287
return Err ( ParsingError :: Incomplete ) ;
287
288
}
288
289
buf. copy_to_slice ( & mut ip) ;
You can’t perform that action at this time.
0 commit comments