krb5 commit: Avoid unsigned/signed comparison in loop condition

Benjamin Kaduk kaduk at MIT.EDU
Tue Jul 3 00:43:52 EDT 2012


https://github.com/krb5/krb5/commit/f59478241686d75ece48e8eff6099006cf0bb1b2
commit f59478241686d75ece48e8eff6099006cf0bb1b2
Author: Ben Kaduk <kaduk at mit.edu>
Date:   Wed Jun 27 15:38:47 2012 -0400

    Avoid unsigned/signed comparison in loop condition
    
    The gid_len length is declared as an unsigned int, and loop
    index 'i' is a signed int.  This could manifest as an infinite
    loop if gid_len is very large.  In practice, gid_len should be small,
    but make 'i' the same type for consistency.

 src/lib/rpc/svc_auth_unix.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/lib/rpc/svc_auth_unix.c b/src/lib/rpc/svc_auth_unix.c
index 406abf7..a4b87d8 100644
--- a/src/lib/rpc/svc_auth_unix.c
+++ b/src/lib/rpc/svc_auth_unix.c
@@ -66,8 +66,7 @@ gssrpc__svcauth_unix(
 		char area_machname[MAX_MACHINE_NAME+1];
 		int area_gids[NGRPS];
 	} *area;
-	u_int auth_len, str_len, gid_len;
-	register int i;
+	u_int auth_len, str_len, gid_len, i;
 
 	rqst->rq_xprt->xp_auth = &svc_auth_none;
 


More information about the cvs-krb5 mailing list