1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

fsp, smb: abort connection on empty files.

Empty files were causing 'read from socket' errors.
This commit is contained in:
Witold Filipczyk 2007-01-25 13:38:32 +01:00 committed by Witold Filipczyk
parent 1d3cd264e9
commit eef1c17dce
2 changed files with 14 additions and 2 deletions

View File

@ -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);

View File

@ -387,6 +387,12 @@ smb_got_header(struct socket *socket, struct read_buffer *rb)
conn->est_length = (off_t)atoi(ctype);
#endif
mem_free(ctype);
/* avoid error */
if (!conn->est_length) {
abort_connection(conn, S_OK);
return;
}
}
else mem_free_set(&conn->cached->content_type, ctype);
}