]> granicus.if.org Git - curl/commitdiff
telnet.c: fix invalid use of custom read function if not being set
authorMarc Hoersken <info@marc-hoersken.de>
Tue, 24 Feb 2015 23:01:14 +0000 (00:01 +0100)
committerMarc Hoersken <info@marc-hoersken.de>
Tue, 24 Feb 2015 23:01:14 +0000 (00:01 +0100)
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.

lib/telnet.c

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