1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-17 06:55:02 -05:00

socks: use size_t for size variable

Use the unsigned type (size_t) in the arithmetic of pointers. In this
context, the signed type (ssize_t) is used unnecessarily.

Authored-by: ihsinme on github
Closes #5654
This commit is contained in:
ihsinme 2020-07-05 15:19:25 +03:00 committed by Daniel Stenberg
parent 2bd8fe8823
commit 60aa961288
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -327,18 +327,18 @@ CURLcode Curl_SOCKS4(const char *proxy_user,
* Make connection * Make connection
*/ */
{ {
ssize_t packetsize = 9 + size_t packetsize = 9 +
strlen((char *)socksreq + 8); /* size including NUL */ strlen((char *)socksreq + 8); /* size including NUL */
/* If SOCKS4a, set special invalid IP address 0.0.0.x */ /* If SOCKS4a, set special invalid IP address 0.0.0.x */
if(protocol4a) { if(protocol4a) {
ssize_t hostnamelen = 0; size_t hostnamelen = 0;
socksreq[4] = 0; socksreq[4] = 0;
socksreq[5] = 0; socksreq[5] = 0;
socksreq[6] = 0; socksreq[6] = 0;
socksreq[7] = 1; socksreq[7] = 1;
/* append hostname */ /* append hostname */
hostnamelen = (ssize_t)strlen(hostname) + 1; /* length including NUL */ hostnamelen = strlen(hostname) + 1; /* length including NUL */
if(hostnamelen <= 255) if(hostnamelen <= 255)
strcpy((char *)socksreq + packetsize, hostname); strcpy((char *)socksreq + packetsize, hostname);
else { else {