]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
socks: use size_t for size variable
authorihsinme <61293369+ihsinme@users.noreply.github.com>
Sun, 5 Jul 2020 12:19:25 +0000 (15:19 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 12 Jul 2020 20:52:19 +0000 (22:52 +0200)
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

lib/socks.c

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