From: Ralph Boehme Date: Mon, 17 Jul 2023 12:51:54 +0000 (+0200) Subject: mdssvc: introduce MAX_MDSCMD_SIZE X-Git-Tag: ldb-2.8.0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68bb582bc513448a9b16705ca566539cfaf45882;p=thirdparty%2Fsamba.git mdssvc: introduce MAX_MDSCMD_SIZE Allow larger value for the reassembled mdscmd's. Now that the client supports fragementation, when processing reassambled large result sets from macOS Spotlight server, it's possible to hit this limit in the unmarshalling code. Let's just increase it to some larger value. Signed-off-by: Ralph Boehme Reviewed-by: Noel Power --- diff --git a/source3/rpc_server/mdssvc/marshalling.c b/source3/rpc_server/mdssvc/marshalling.c index 5f866d7fb6e..c9c9384bb87 100644 --- a/source3/rpc_server/mdssvc/marshalling.c +++ b/source3/rpc_server/mdssvc/marshalling.c @@ -667,12 +667,12 @@ static ssize_t sl_unpack_tag(const char *buf, tag->count = val >> 32; tag->length = tag->count * 8; - if (tag->size > MAX_SL_FRAGMENT_SIZE) { + if (tag->size > MAX_MDSCMD_SIZE) { DEBUG(1,("%s: size limit %zu\n", __func__, tag->size)); return -1; } - if (tag->length > MAX_SL_FRAGMENT_SIZE) { + if (tag->length > MAX_MDSCMD_SIZE) { DEBUG(1,("%s: length limit %zu\n", __func__, tag->length)); return -1; } @@ -963,7 +963,7 @@ static ssize_t sl_unpack_cpx(DALLOC_CTX *query, return -1; } slen = tag.size - 16 + tag.count; - if (slen > MAX_SL_FRAGMENT_SIZE) { + if (slen > MAX_MDSCMD_SIZE) { return -1; } @@ -1312,7 +1312,7 @@ bool sl_unpack(DALLOC_CTX *query, const char *buf, size_t bufsize) uint64_t toc_offset; struct sl_tag toc_tag; - if (bufsize > MAX_SL_FRAGMENT_SIZE) { + if (bufsize > MAX_MDSCMD_SIZE) { return false; } diff --git a/source3/rpc_server/mdssvc/marshalling.h b/source3/rpc_server/mdssvc/marshalling.h index 2cc1b44712c..ccc8b442268 100644 --- a/source3/rpc_server/mdssvc/marshalling.h +++ b/source3/rpc_server/mdssvc/marshalling.h @@ -27,6 +27,7 @@ #include "librpc/gen_ndr/mdssvc.h" #define MAX_SL_FRAGMENT_SIZE 0xFFFFF +#define MAX_MDSCMD_SIZE 0xFFFFFF /* Can be ored and used as flags */ #define SL_ENC_LITTLE_ENDIAN 1