diff options
author | Omar Polo <op@omarpolo.com> | 2021-06-16 15:06:10 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-06-16 15:06:10 +0000 |
commit | 1b78bd563a8779c8be71c0489abb92a61e21f8f1 (patch) | |
tree | 309d045320607807028e89f8dc4634d0743958d6 | |
parent | 80fbf1e934ed1e2dafea65e88bb91a501f175a3b (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.
-rw-r--r-- | server.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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"); } |