Skip to content
Snippets Groups Projects
Commit abf527b5 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf
Browse files

samba: limit the read size

Fixes #22909
parent e71404e5
No related branches found
No related tags found
No related merge requests found
......@@ -101,6 +101,16 @@ static ssize_t Read( stream_t *p_access, void *p_buffer, size_t i_len )
access_sys_t *p_sys = p_access->p_sys;
int i_read;
/* cf. DEFAULT_SMB2_MAX_READ (= 8MB) from the samba project. Reading more
* than this limit will likely result on a ECONNABORTED
* (STATUS_CONNECTION_ABORTED) error. Since this value can be lowered by
* the server, let decrease this limit (/8) to have more chance to get a
* working limit on our side.
* XXX: There is no way to retrieve this value when using the old smbc_*
* interface. */
if( i_len > (1024 << 10) ) /* 8MB / 8 = 1MB */
i_len = 1024 << 10;
i_read = smbc_read( p_sys->i_smb, p_buffer, i_len );
if( i_read < 0 )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment