]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
small code tweaks to try to work around debian stable complaints
authorNick Mathewson <nickm@torproject.org>
Mon, 10 Aug 2020 21:36:21 +0000 (17:36 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 10 Aug 2020 23:20:05 +0000 (19:20 -0400)
src/feature/rend/rendclient.c
src/lib/net/address.c

index cde954da953bf59abd6bcbba4bc12893914ffd31..5c9dbea8e3887b3eecf1c1f38fc79c5b8ca0a236 100644 (file)
@@ -261,8 +261,8 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
             > MAX_NICKNAME_LEN)) {
       goto perm_err;
     }
-    strncpy(tmp, rendcirc->build_state->chosen_exit->nickname,
-            (MAX_NICKNAME_LEN+1)); /* nul pads */
+    strlcpy(tmp, rendcirc->build_state->chosen_exit->nickname,
+            sizeof(tmp));
     memcpy(tmp+MAX_NICKNAME_LEN+1, rendcirc->rend_data->rend_cookie,
            REND_COOKIE_LEN);
     dh_offset = MAX_NICKNAME_LEN+1+REND_COOKIE_LEN;
index 076ca3eb3413682a9c2805a49f1a928e6ed3c4c2..69004ddb0ee179fe0af9f6eb282255a71aef0ee8 100644 (file)
@@ -337,7 +337,7 @@ tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len, int decorate)
       break;
     case AF_INET6:
       /* Shortest addr [ :: ] + \0 */
-      if (len < (3 + (decorate ? 2 : 0)))
+      if (len < (3 + (decorate ? 2u : 0u)))
         return NULL;
 
       if (decorate)