# HG changeset patch # User Mark Doliner # Date 1250128074 0 # Node ID 3157a8ea0012bb086bbd365816476d41a0ad5d1d # Parent 4f7eded28919a38bc28bf408bcb95e3efce1b465 Just add a note that this code sucks diff -r 4f7eded28919 -r 3157a8ea0012 libpurple/protocols/msn/directconn.c --- a/libpurple/protocols/msn/directconn.c Thu Aug 13 01:31:15 2009 +0000 +++ b/libpurple/protocols/msn/directconn.c Thu Aug 13 01:47:54 2009 +0000 @@ -259,6 +259,19 @@ directconn = data; /* Let's read the length of the data. */ +#error This code is broken. See the note below. + /* + * TODO: This has problems! First of all, sizeof(body_len) will be + * different on 32bit systems and on 64bit systems (4 bytes + * vs. 8 bytes). + * Secondly, we're reading from a TCP stream. There is no + * guarantee that we have received the number of bytes we're + * trying to read. We need to read into a buffer. If read + * returns <0 then we need to check errno. If errno is EAGAIN + * then don't destroy anything, just exit and wait for more + * data. See every other function in libpurple that does this + * correctly for an example. + */ len = read(directconn->fd, &body_len, sizeof(body_len)); if (len <= 0)