[PATCH] for kioslave/connection.cpp

Matthias Welwarsky matze at stud.fbi.fh-darmstadt.de
Sun Nov 10 13:55:14 GMT 2002


Hi,

Dirk asked me to repost this patch here for review.

I still have this patch for kdelibs/kio/kio/connection.cpp on my local copy.
This patch fixes a possible endless loop and thus a hang of an application. I
posted this patch a few weeks ago but noone confirmed it. There was a short
discussion about it not fixing the real problem, but I cannot come up with a
better solution.

I've seen it happening at least once in kmail, probably because the imap
ioslave just closed it's data connection to the application. I'd like to see
this patch in, sorry that I'm such a late bird again.

I've appended the patch, please review and commit.

regards,
	matze
--
Matthias Welwarsky
Fachschaft Informatik FH Darmstadt
Email: matze at stud.fbi.fh-darmstadt.de

"all software sucks equally, but some software is more equal"

Index: connection.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/connection.cpp,v
retrieving revision 1.47
diff -u -3 -p -r1.47 connection.cpp
--- connection.cpp      2002/06/19 17:46:00     1.47
+++ connection.cpp      2002/11/05 08:16:35
@@ -244,6 +244,11 @@ int Connection::read( int* _cmd, QByteAr
                return -1;
            }

+           if ( n == 0 ) {
+               kdError( 7017 ) << "Unexpected end of data" << endl;
+               return -1;
+           }
+
            bytesRead += n;
            bytesToGo -= n;
        }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20021110/8f67a922/attachment.sig>


More information about the kfm-devel mailing list