fix socks5 probe

This commit is contained in:
Yves Rutschle 2018-06-13 09:52:49 +02:00
parent 552723cc5f
commit dfd9e14866

View File

@ -313,8 +313,11 @@ static int is_adb_protocol(const char *p, int len, struct proto *proto)
return probe_adb_cnxn_message(&p[sizeof(empty_message)]);
}
static int is_socks5_protocol(const char *p, int len, struct proto *proto)
static int is_socks5_protocol(const char *p_in, int len, struct proto *proto)
{
unsigned char* p = (unsigned char*)p_in;
int i;
if (len < 2)
return PROBE_AGAIN;
@ -334,8 +337,8 @@ static int is_socks5_protocol(const char *p, int len, struct proto *proto)
return PROBE_AGAIN;
/* Each authentication method number should be in range 0..9 */
for (unsigned char i = 0; i < m_count; i++) {
if (p[3 + i] < 0 || p[3 + i] > 9)
for (i = 0; i < m_count; i++) {
if (p[2 + i] > 9)
return PROBE_NEXT;
}
return PROBE_MATCH;