]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
telnet: error correctly for WS set to "x[num]"
authorDaniel Stenberg <daniel@haxx.se>
Fri, 24 Feb 2023 17:38:32 +0000 (18:38 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 24 Feb 2023 22:00:26 +0000 (23:00 +0100)
Follow-up to e4f93be9d587
Reported-by: Harry Sintonen
Closes #10606

lib/telnet.c

index 720fbd10aef0bee9b208d68704e420e88b7c0938..dc39de481c67e974587801834eb58fe919fae88b 100644 (file)
@@ -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;