]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
telnet: check return code from fileno()
authorDaniel Stenberg <daniel@haxx.se>
Wed, 24 Apr 2024 06:07:34 +0000 (08:07 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 24 Apr 2024 08:51:53 +0000 (10:51 +0200)
and return error if necessary

Spotted by CodeSonar

Closes #13457

lib/telnet.c

index b129ff5202102eb45708742784df3c46ed9cca14..7c2850449470b052e92f7ce0e6276215e763be4b 100644 (file)
@@ -1535,6 +1535,11 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
     pfd[1].events = POLLIN;
     poll_cnt = 2;
     interval_ms = 1 * 1000;
+    if(pfd[1].fd < 0) {
+      failf(data, "cannot read input");
+      result = CURLE_RECV_ERROR;
+      keepon = FALSE;
+    }
   }
 
   while(keepon) {