telnet.c: fix invalid use of custom read function if not being set

obj_count can be 1 if the custom read function is set or the stdin
handle is a reference to a pipe. Since the pipe should be handled
using the PeekNamedPipe-check below, the custom read function should
only be used if it is actually enabled.
This commit is contained in:
Marc Hoersken
2015-02-25 00:01:14 +01:00
parent 03fa576833
commit b3bcdaf01a

View File

@@ -1427,7 +1427,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
case WAIT_TIMEOUT: case WAIT_TIMEOUT:
{ {
for(;;) { for(;;) {
if(obj_count == 1) { if(data->set.is_fread_set) {
/* read from user-supplied method */ /* read from user-supplied method */
result = (int) conn->fread_func(buf, 1, BUFSIZE - 1, conn->fread_in); result = (int) conn->fread_func(buf, 1, BUFSIZE - 1, conn->fread_in);
if(result == CURL_READFUNC_ABORT) { if(result == CURL_READFUNC_ABORT) {