]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
LDB:NSS - make LDB "signed-safe" on counter variables
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Fri, 6 Nov 2009 17:35:17 +0000 (18:35 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 2 Mar 2010 17:02:00 +0000 (18:02 +0100)
"i" needs to be unsigned on both places since it counts till a "count" variable
of a "struct ldb_result" object which itself is unsigned.

I see counting variables much better as "unsigned" since in most cases we don't
use negative values at all. We've only to be careful on binary searches and
downto counts regarding them.

source4/lib/ldb/nssldb/ldb-nss.c

index 8f7321031bede901cf8fd44eb7724df193726e15..92b0635561e71a467a3d6d4e180aaec6693ceabf 100644 (file)
@@ -191,7 +191,7 @@ NSS_STATUS _ldb_nss_fill_group(struct group *result,
        size_t len;
        size_t bufpos;
        size_t lsize;
-       int i;
+       unsigned int i;
 
        bufpos = 0;
 
@@ -280,7 +280,7 @@ NSS_STATUS _ldb_nss_fill_initgr(gid_t group,
                                struct ldb_result *grlist)
 {
        NSS_STATUS ret;
-       int i;
+       unsigned int i;
 
        for (i = 0; i < grlist->count; i++) {