[dovecot-cvs] dovecot/src/pop3-login client.c,1.37,1.38
cras at dovecot.org
cras at dovecot.org
Sun Nov 28 02:04:37 EET 2004
Update of /var/lib/cvs/dovecot/src/pop3-login
In directory talvi:/tmp/cvs-serv2373/pop3-login
Modified Files:
client.c
Log Message:
Don't destroy client structure immediately when sending line fails. Fixes some writes to freed memory.
Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- client.c 25 Nov 2004 14:49:25 -0000 1.37
+++ client.c 28 Nov 2004 00:04:35 -0000 1.38
@@ -430,10 +430,14 @@
iov[1].iov_base = "\r\n";
iov[1].iov_len = 2;
- if ((ret = o_stream_sendv(client->output, iov, 2)) < 0)
- client_destroy(client, "Disconnected");
- else if ((size_t)ret != iov[0].iov_len + iov[1].iov_len)
- client_destroy(client, "Transmit buffer full");
+ ret = o_stream_sendv(client->output, iov, 2);
+ if (ret < 0 || (size_t)ret != iov[0].iov_len + iov[1].iov_len) {
+ /* either disconnection or buffer full. in either case we
+ want this connection destroyed. however destroying it here
+ might break things if client is still tried to be accessed
+ without being referenced.. */
+ i_stream_close(client->input);
+ }
}
static void client_check_idle(struct pop3_client *client)
More information about the dovecot-cvs
mailing list