From 6cf69b294887e643fe7e91759cbc287a2502aedd Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 25 Jan 2007 13:38:32 +0100 Subject: [PATCH] fsp: abort connection on empty files. Empty files were causing 'read from socket' errors. [ This is half of commit eef1c17dcef38d35848e75fff3c450bf40e9e851 from the witekfl branch. The SMB half is in commit 916b5cf54536a894abacdfdd6233a58e470d4e6b. --KON ] --- src/protocol/fsp/fsp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c index 4194258e0..7441ba41e 100644 --- a/src/protocol/fsp/fsp.c +++ b/src/protocol/fsp/fsp.c @@ -316,12 +316,18 @@ fsp_got_header(struct socket *socket, struct read_buffer *rb) if (ctype[0] >= '0' && ctype[0] <= '9') { conn->est_length = (off_t)atoi(ctype); mem_free(ctype); + + /* avoid read from socket error */ + if (!conn->est_length) { + abort_connection(conn, S_OK); + return; + } } else mem_free_set(&conn->cached->content_type, ctype); } - } - else + } else { mem_free_if(ctype); + } } buf = alloc_read_buffer(conn->data_socket);