Replace strncpy with snprintf where necessary

This commit is contained in:
2021-05-11 22:10:02 +02:00
parent 43c512dc5a
commit 4994b4375b
6 changed files with 7 additions and 6 deletions

View File

@ -125,7 +125,7 @@ int http_receive_request(sock *client, http_req *req) {
return 2;
}
}
strncpy(req->method, ptr, pos1 - ptr - 1);
snprintf(req->method, sizeof(req->method), "%.*s", (int) (pos1 - ptr - 1), ptr);
pos2 = memchr(pos1, ' ', rcv_len - (pos1 - buf)) + 1;
if (pos2 == NULL) {