use memchr
authorKen Raeburn <raeburn@mit.edu>
Tue, 27 Jan 2009 22:00:15 +0000 (22:00 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 27 Jan 2009 22:00:15 +0000 (22:00 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21809 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/do_tgs_req.c

index a556fb2a00ea5f3a662a7f52729e910212de618c..afc6367eba2db0734280f331e833b990688eaa2e 100644 (file)
@@ -1069,7 +1069,6 @@ static krb5_int32
 prep_reprocess_req(krb5_kdc_req *request, krb5_principal *krbtgt_princ) 
 {
     krb5_error_code retval = KRB5KRB_AP_ERR_BADMATCH;
-    size_t len = 0;
     char **realms, **cpp, *temp_buf=NULL;
     krb5_data *comp1 = NULL, *comp2 = NULL; 
     krb5_int32 host_based_srv_listed = 0, no_host_referral_listed = 0;
@@ -1120,11 +1119,8 @@ prep_reprocess_req(krb5_kdc_req *request, krb5_principal *krbtgt_princ)
             (!strchr(kdc_active_realm->realm_host_based_services, '*') &&
             no_host_referral_listed == FALSE))) { 
 
-            for (len=0; len < comp2->length; len++) {     
-                 if (comp2->data[len] == '.') break;
-            }
-            if (len == comp2->length)    
-                goto cleanup; 
+            if (memchr(comp2->data, '.', comp2->length) == NULL)
+                goto cleanup;
             temp_buf = calloc(1, comp2->length+1);
             if (!temp_buf){
                 retval = ENOMEM;