]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
srvsvcd: Fix shareinfo2 max_connections calculation
authorVolker Lendecke <vl@samba.org>
Sun, 15 May 2022 11:17:06 +0000 (13:17 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 20 May 2022 19:02:37 +0000 (19:02 +0000)
lp_max_connections() being an int could be >UINT32_MAX

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_server/srvsvc/srv_srvsvc_nt.c

index b634170a0c954a8def559eb4844031d143a5cab9..fcfcf0493f3ac92069206f4c566a117db49710a5 100644 (file)
@@ -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(