krb5 commit: Fix error handling in allocate_princ()
    Greg Hudson 
    ghudson at MIT.EDU
       
    Fri Jul 13 12:03:28 EDT 2012
    
    
  
https://github.com/krb5/krb5/commit/d938577dc1628f4dc8a0af3657020ee444a78c1b
commit d938577dc1628f4dc8a0af3657020ee444a78c1b
Author: Greg Hudson <ghudson at mit.edu>
Date:   Fri Jul 13 12:03:08 2012 -0400
    Fix error handling in allocate_princ()
    
    The most recent change could leak memory when trying to parse an
    invalid principal because of a failure to use the cleanup handler.
 src/lib/krb5/krb/parse.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/krb5/krb/parse.c b/src/lib/krb5/krb/parse.c
index 613e41d..c55381a 100644
--- a/src/lib/krb5/krb/parse.c
+++ b/src/lib/krb5/krb/parse.c
@@ -79,8 +79,10 @@ allocate_princ(krb5_context context, const char *name, krb5_boolean enterprise,
         } else if (*p == '@' && (!enterprise || !first_at)) {
             /* Realm separator.  In enterprise principals, the first one of
              * these we see is part of the component. */
-            if (cur_data == &princ->realm)
-                return KRB5_PARSE_MALFORMED;
+            if (cur_data == &princ->realm) {
+                ret = KRB5_PARSE_MALFORMED;
+                goto cleanup;
+            }
             cur_data = &princ->realm;
         } else {
             /* Component or realm character, possibly quoted.  Make note if
    
    
More information about the cvs-krb5
mailing list