mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:21:41 +03:00
curlx: curlx_strcopy() instead of strcpy()
This function REQUIRES the size of the target buffer as well as the length of the source string. Meant to make it harder to do a bad strcpy(). Removes 23 calls to strcpy(). Closes #20067
This commit is contained in:
parent
f099c2ca55
commit
a535be4ea0
30 changed files with 195 additions and 97 deletions
3
lib/ws.c
3
lib/ws.c
|
|
@ -40,6 +40,7 @@
|
|||
#include "transfer.h"
|
||||
#include "select.h"
|
||||
#include "curlx/strparse.h"
|
||||
#include "curlx/strcopy.h"
|
||||
|
||||
/***
|
||||
RFC 6455 Section 5.2
|
||||
|
|
@ -1274,7 +1275,7 @@ CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
|
|||
curlx_free(randstr);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
strcpy(keyval, randstr);
|
||||
curlx_strcopy(keyval, sizeof(keyval), randstr, randlen);
|
||||
curlx_free(randstr);
|
||||
for(i = 0; !result && (i < CURL_ARRAYSIZE(heads)); i++) {
|
||||
if(!Curl_checkheaders(data, heads[i].name, strlen(heads[i].name))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue