[vlc-commits] [Git][videolan/vlc][master] samba: limit the read size

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Dec 13 09:56:35 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
abf527b5 by Thomas Guillem at 2021-12-13T09:34:44+00:00
samba: limit the read size

Fixes #22909

- - - - -


1 changed file:

- modules/access/samba.c


Changes:

=====================================
modules/access/samba.c
=====================================
@@ -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 )
     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/abf527b59d632db06fae67b1322890c273a241c6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/abf527b59d632db06fae67b1322890c273a241c6
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list