]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: msdfs: Cleanup, don't mix int and size_t types for a count variable.
authorJeremy Allison <jra@samba.org>
Fri, 13 Dec 2019 17:39:55 +0000 (09:39 -0800)
committerRalph Boehme <slow@samba.org>
Mon, 16 Dec 2019 14:05:33 +0000 (14:05 +0000)
Add integer wrap check.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/msdfs.c

index a70e795f0caf9b3c8ac376d7a0aeae20b7960e1a..67e736a84f08369912a27d917b568678dc0e18b9 100644 (file)
@@ -1500,7 +1500,7 @@ bool remove_msdfs_link(const struct junction_map *jucn)
  Return the number of DFS links at the root of this share.
 *********************************************************************/
 
-static int count_dfs_links(TALLOC_CTX *ctx, int snum)
+static size_t count_dfs_links(TALLOC_CTX *ctx, int snum)
 {
        TALLOC_CTX *frame = talloc_stackframe();
        const struct loadparm_substitution *lp_sub =
@@ -1573,6 +1573,10 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum)
                        goto out;
                }
                if (is_msdfs_link(conn, smb_dname)) {
+                       if (cnt + 1 < cnt) {
+                               cnt = 0;
+                               goto out;
+                       }
                        cnt++;
                }
                TALLOC_FREE(talloced);