pam_ksu: Move the realm free to end of function
This avoids a use after free. Noted by: jhb
This commit is contained in:
@@ -85,8 +85,6 @@ krb5_make_principal(krb5_context context, krb5_principal principal,
|
||||
if ((rc = krb5_get_default_realm(context, &temp_realm)))
|
||||
return (rc);
|
||||
realm=temp_realm;
|
||||
if (temp_realm)
|
||||
free(temp_realm);
|
||||
}
|
||||
va_start(ap, realm);
|
||||
/*
|
||||
@@ -99,6 +97,8 @@ krb5_make_principal(krb5_context context, krb5_principal principal,
|
||||
*/
|
||||
rc = krb5_build_principal_va(context, principal, strlen(realm), realm, ap);
|
||||
va_end(ap);
|
||||
if (temp_realm)
|
||||
free(temp_realm);
|
||||
return (rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user