From: Daniel Stenberg Date: Wed, 24 Apr 2024 06:07:34 +0000 (+0200) Subject: telnet: check return code from fileno() X-Git-Tag: curl-8_8_0~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a090111613c52066f786adbc05cc7ce9cc3cf3a3;p=thirdparty%2Fcurl.git telnet: check return code from fileno() and return error if necessary Spotted by CodeSonar Closes #13457 --- diff --git a/lib/telnet.c b/lib/telnet.c index b129ff5202..7c28504494 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -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) {