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:
parent
1d3cd264e9
commit
eef1c17dce
@ -316,13 +316,19 @@ 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);
|
||||
if (!buf) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user