Fix bug where an allocated structure was used before it was checked to
authorTheodore Tso <tytso@mit.edu>
Thu, 3 Jun 1993 00:11:44 +0000 (00:11 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 3 Jun 1993 00:11:44 +0000 (00:11 +0000)
see if it were null.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2552 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/copy_auth.c

index c4352191c5454cc3ab89fc52aba07fb8a796c9ea..f3d19865e24975b7fba3474a1ad7ed4798a64bad 100644 (file)
@@ -65,13 +65,13 @@ krb5_authdata ***outauthdat;
     krb5_authdata ** tempauthdat;
     register int nelems = 0;
 
-    while (inauthdat[nelems]) nelems++;
-
     if (!inauthdat) {
            *outauthdat = 0;
            return 0;
     }
 
+    while (inauthdat[nelems]) nelems++;
+
     /* one more for a null terminated list */
     if (!(tempauthdat = (krb5_authdata **) calloc(nelems+1,
                                                  sizeof(*tempauthdat))))