mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:43:33 +03:00
lib: reduce use of strncpy
- bearssl: select cipher without buffer copies - http_aws_sigv4: avoid strncpy, require exact timestamp length - http_aws_sigv4: use memcpy isntead of strncpy - openssl: avoid strncpy calls - schannel: check for 1.3 algos without buffer copies - strerror: avoid strncpy calls - telnet: avoid strncpy, return error on too long inputs - vtls: avoid strncpy in multissl_version() Closes #12499
This commit is contained in:
parent
9efdefe6b1
commit
ff74cef5d4
7 changed files with 101 additions and 98 deletions
24
lib/telnet.c
24
lib/telnet.c
|
|
@ -826,23 +826,27 @@ static CURLcode check_telnet_options(struct Curl_easy *data)
|
|||
case 5:
|
||||
/* Terminal type */
|
||||
if(strncasecompare(option, "TTYPE", 5)) {
|
||||
strncpy(tn->subopt_ttype, arg, 31);
|
||||
tn->subopt_ttype[31] = 0; /* String termination */
|
||||
tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;
|
||||
size_t l = strlen(arg);
|
||||
if(l < sizeof(tn->subopt_ttype)) {
|
||||
strcpy(tn->subopt_ttype, arg);
|
||||
tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
result = CURLE_UNKNOWN_OPTION;
|
||||
result = CURLE_UNKNOWN_OPTION;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/* Display variable */
|
||||
if(strncasecompare(option, "XDISPLOC", 8)) {
|
||||
strncpy(tn->subopt_xdisploc, arg, 127);
|
||||
tn->subopt_xdisploc[127] = 0; /* String termination */
|
||||
tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;
|
||||
size_t l = strlen(arg);
|
||||
if(l < sizeof(tn->subopt_xdisploc)) {
|
||||
strcpy(tn->subopt_xdisploc, arg);
|
||||
tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
result = CURLE_UNKNOWN_OPTION;
|
||||
result = CURLE_UNKNOWN_OPTION;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue