diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-05-14 12:08:03 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-05-20 04:01:11 +0000 |
commit | 8dfad9fa2cc5f9ae464a6df44c7ae0448cc4f3ab (patch) | |
tree | ec37ce52ac541e3fa9c47b8b7f1380658f4c4a39 /source4/ldap_server/ldap_server.c | |
parent | e8475f8ec5fc61409a98667b22e20364c0820cd6 (diff) | |
download | samba-8dfad9fa2cc5f9ae464a6df44c7ae0448cc4f3ab.tar.gz |
ldap_server: chunk the writev() calls at 25MB
This should limit the amount we send to GENSEC at a
time where it may help avoid large realloc or memcpy calls.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source4/ldap_server/ldap_server.c')
-rw-r--r-- | source4/ldap_server/ldap_server.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 53e9af94888..4d3d8cd1188 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -683,9 +683,16 @@ static void ldapsrv_call_writev_start(struct ldapsrv_call *call) for (reply = call->replies; reply != NULL; reply = reply->next) { + + /* Cap output at 25MB per writev() */ + if (length > length + reply->blob.length + || length + reply->blob.length > LDAP_SERVER_MAX_CHUNK_SIZE) { + break; + } + /* * Overflow is harmless here, just used below to - * decide if to read or write + * decide if to read or write, but checkd above anyway */ length += reply->blob.length; |