summaryrefslogtreecommitdiff
path: root/lib/telnet.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2023-02-24 18:38:32 +0100
committerDaniel Stenberg <daniel@haxx.se>2023-02-24 23:00:26 +0100
commitcbd3fd7cbbac2424659a691d9d5026b60ed34937 (patch)
tree91184fa1a180473dac75accf83f05a70554779ef /lib/telnet.c
parent5ed7417d2fe4c8ccfd3e691280bfb4287b063167 (diff)
downloadcurl-cbd3fd7cbbac2424659a691d9d5026b60ed34937.tar.gz
telnet: error correctly for WS set to "x[num]"
Follow-up to e4f93be9d587 Reported-by: Harry Sintonen Closes #10606
Diffstat (limited to 'lib/telnet.c')
-rw-r--r--lib/telnet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/telnet.c b/lib/telnet.c
index 720fbd10a..dc39de481 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -844,10 +844,10 @@ static CURLcode check_telnet_options(struct Curl_easy *data)
char *p;
unsigned long x = strtoul(arg, &p, 10);
unsigned long y = 0;
- if(Curl_raw_tolower(*p) == 'x') {
+ if(x && (x <= 0xffff) && Curl_raw_tolower(*p) == 'x') {
p++;
y = strtoul(p, NULL, 10);
- if(x && y && (x <= 0xffff) && (y <= 0xffff)) {
+ if(y && (y <= 0xffff)) {
tn->subopt_wsx = (unsigned short)x;
tn->subopt_wsy = (unsigned short)y;
tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES;