Skip to content

Commit 3b4bf3f

Browse files
committed
telnet: replace atoi for BINARY handling with curlx_str_number
Also, only consider 0 to be a valid switch-off. Previously any value except 1 had the same effect. Closes curl#19477
1 parent 97b0abb commit 3b4bf3f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/telnet.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,10 @@ static CURLcode check_telnet_options(struct Curl_easy *data,
895895
case 6:
896896
/* To take care or not of the 8th bit in data exchange */
897897
if(curl_strnequal(option, "BINARY", 6)) {
898-
int binary_option = atoi(arg);
899-
if(binary_option != 1) {
898+
const char *p = arg;
899+
curl_off_t binary_option;
900+
if(!curlx_str_number(&p, &binary_option, 1) &&
901+
(binary_option != 1)) {
900902
tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO;
901903
tn->him_preferred[CURL_TELOPT_BINARY] = CURL_NO;
902904
}

0 commit comments

Comments
 (0)