Commit Diff
- Commit:
1b78bd563a8779c8be71c0489abb92a61e21f8f1
- From:
- Omar Polo <op@omarpolo.com>
- Date:
- Message:
- 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.
- Actions:
- Patch | Tree
--- 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"); }