krb5 commit [krb5-1.11]: Fix use-before-init in two test programs

Tom Yu tlyu at MIT.EDU
Fri Nov 8 14:15:04 EST 2013


https://github.com/krb5/krb5/commit/07704a74aca13a05d4959dc1c0d1b85889dbd7bf
commit 07704a74aca13a05d4959dc1c0d1b85889dbd7bf
Author: Greg Hudson <ghudson at mit.edu>
Date:   Fri Mar 15 01:57:40 2013 -0400

    Fix use-before-init in two test programs
    
    If krb5_init_context fails, use a null context for getting the error
    message, not a context we haven't yet initialized.  Observed by David
    Benjamin <davidben at mit.edu> using clang.
    
    (cherry picked from commit 525eafc83a0fbe8f215b7749b5774d54468a19d1)
    
    ticket: 7760
    version_fixed: 1.11.5
    status: resolved

 src/lib/krb5/krb/t_cc_config.c |    2 +-
 src/lib/krb5/krb/t_in_ccache.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/krb5/krb/t_cc_config.c b/src/lib/krb5/krb/t_cc_config.c
index 3750a59..04e7283 100644
--- a/src/lib/krb5/krb/t_cc_config.c
+++ b/src/lib/krb5/krb/t_cc_config.c
@@ -117,7 +117,7 @@ main(int argc, char **argv)
     int c;
     unsigned int i;
 
-    bail_on_err(context, "Error initializing Kerberos library",
+    bail_on_err(NULL, "Error initializing Kerberos library",
                 krb5_init_context(&context));
     bail_on_err(context, "Error getting location of default ccache",
                 krb5_cc_default(context, &ccache));
diff --git a/src/lib/krb5/krb/t_in_ccache.c b/src/lib/krb5/krb/t_in_ccache.c
index c73a043..30b7f28 100644
--- a/src/lib/krb5/krb/t_in_ccache.c
+++ b/src/lib/krb5/krb/t_in_ccache.c
@@ -95,7 +95,7 @@ main(int argc, char **argv)
     user = argv[optind];
     password = argv[optind + 1];
 
-    bail_on_err(ctx, "Error initializing Kerberos", krb5_init_context(&ctx));
+    bail_on_err(NULL, "Error initializing Kerberos", krb5_init_context(&ctx));
     bail_on_err(ctx, "Error allocating space for get_init_creds options",
                 krb5_get_init_creds_opt_alloc(ctx, &opt));
     if (in_ccname != NULL) {


More information about the cvs-krb5 mailing list