socks5: use appropriate ATYP for numerical IP address host names

When not resolving the address locallly (known as socks5h).

Add test 719 and 720 to verify.

Reported-by: Peter Piekarski
Fixes #8216
Closes #8217
This commit is contained in:
Daniel Stenberg 2022-01-03 11:29:21 +01:00
parent 53a3e90e06
commit effd2bd7ba
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 143 additions and 7 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -513,6 +513,7 @@ static curl_socket_t sockit(curl_socket_t fd)
logmsg("Request too short: %d, expected %d", rc, 4 + len + 2);
return CURL_SOCKET_BAD;
}
logmsg("Received ATYP %d", type);
if(!config.port) {
unsigned char *portp = &buffer[SOCKS5_DSTADDR + len];