aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-16 15:06:10 +0000
committerOmar Polo <op@omarpolo.com>2021-06-16 15:06:10 +0000
commit1b78bd563a8779c8be71c0489abb92a61e21f8f1 (patch)
tree309d045320607807028e89f8dc4634d0743958d6 /server.c
parent80fbf1e934ed1e2dafea65e88bb91a501f175a3b (diff)
strncpy -> strlcpy
quoting strncpy(3) strncpy() only NUL terminates the destination string when the length of the source string is less than the length parameter. strlcpy is more intuitive. this is another warning gcc 8 found that clang didn't.
Diffstat (limited to 'server.c')
-rw-r--r--server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/server.c b/server.c
index 5bc0ff5..d07a642 100644
--- a/server.c
+++ b/server.c
@@ -492,9 +492,9 @@ found:
err:
if (servname != NULL)
- strncpy(c->req, servname, sizeof(c->req));
+ strlcpy(c->req, servname, sizeof(c->req));
else
- strncpy(c->req, "null", sizeof(c->req));
+ strlcpy(c->req, "null", sizeof(c->req));
start_reply(c, BAD_REQUEST, "Wrong/malformed host or missing SNI");
}