commit 1b78bd563a8779c8be71c0489abb92a61e21f8f1 from: Omar Polo date: Wed Jun 16 15:06:10 2021 UTC 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. commit - 80fbf1e934ed1e2dafea65e88bb91a501f175a3b commit + 1b78bd563a8779c8be71c0489abb92a61e21f8f1 blob - 5bc0ff5f0758f85353018dd8e255f45b49c72b3f blob + d07a6429b6cf960bdfd62628fd00466c3eebe03b --- server.c +++ 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"); }