From: Volker Lendecke Date: Sun, 15 May 2022 11:17:06 +0000 (+0200) Subject: srvsvcd: Fix shareinfo2 max_connections calculation X-Git-Tag: talloc-2.3.4~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c90aff07ab82d3e91729d89d48bc14dbb348d0d6;p=thirdparty%2Fsamba.git srvsvcd: Fix shareinfo2 max_connections calculation lp_max_connections() being an int could be >UINT32_MAX Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index b634170a0c9..fcfcf0493f3 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -282,9 +282,13 @@ static void init_srv_share_info_2(struct pipes_struct *p, char *remark = NULL; char *path = NULL; int max_connections = lp_max_connections(snum); - uint32_t max_uses = max_connections!=0 ? max_connections : UINT32_MAX; + uint32_t max_uses = UINT32_MAX; char *net_name = lp_servicename(talloc_tos(), lp_sub, snum); + if (max_connections > 0) { + max_uses = MIN(max_connections, UINT32_MAX); + } + remark = lp_comment(p->mem_ctx, lp_sub, snum); if (remark) { remark = talloc_sub_full(