From 8d2c86c73d57a82c6b02b45eca5ee59c0bc793c4 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Sat, 25 Jul 2020 15:43:43 +0200 Subject: [PATCH] Fix strncat size argument in send_handshake_query Found by clang: client.c:1276:26: warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size] strncat(buf, topdomain, sizeof(buf) - strlen(buf)); ^~~~~~~~~~~~~~~~~~~~~~~~~ --- src/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index cb92729..ae2dcef 100644 --- a/src/client.c +++ b/src/client.c @@ -1273,7 +1273,7 @@ send_handshake_query(int fd, char *prefix) buf[0] = 0; strncat(buf, prefix, 60); /* 63 - space for 3 CMC bytes */ strcat(buf, cmc_dot); - strncat(buf, topdomain, sizeof(buf) - strlen(buf)); + strncat(buf, topdomain, sizeof(buf) - strlen(buf) - 1); send_query(fd, buf); }