krb5 commit [krb5-1.11]: Initialize err variable in krb5_sendto_kdc

Tom Yu tlyu at mit.edu
Fri Feb 6 17:26:51 EST 2015


https://github.com/krb5/krb5/commit/2faf2b4d8e95f9bc14338c6f6aaa8dc174f35435
commit 2faf2b4d8e95f9bc14338c6f6aaa8dc174f35435
Author: Nalin Dahyabhai <nalin at dahyabhai.net>
Date:   Tue Mar 11 13:26:32 2014 -0400

    Initialize err variable in krb5_sendto_kdc
    
    When we get an KRB5_KDC_UNREACH error back from k5_sendto, we check if
    the err variable we passed for use by our message handler has been set
    to KDC_ERR_SVC_UNAVAILABLE.  If k5_sendto doesn't receive any
    response, though, the handler isn't called, so we're reading an
    uninitialized variable.  Initialize it to a value other than
    KDC_ERR_SVC_UNAVAILABLE to be sure.
    
    [ghudson at mit.edu: initialize err just before calling k5_sendto; edit
    commit message]
    
    (cherry picked from commit 1ed3f68c2394fbb48731bba4e4e9a60c8b925ca5)
    
    ticket: 8088 (new)
    version_fixed: 1.11.6
    status: resolved

 src/lib/krb5/os/sendto_kdc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c
index cc7b86f..050e612 100644
--- a/src/lib/krb5/os/sendto_kdc.c
+++ b/src/lib/krb5/os/sendto_kdc.c
@@ -336,6 +336,7 @@ krb5_sendto_kdc(krb5_context context, const krb5_data *message,
     if (retval)
         return retval;
 
+    err = 0;
     retval = k5_sendto(context, message, &servers, socktype1, socktype2,
                        NULL, reply, NULL, NULL, &server_used,
                        check_for_svc_unavailable, &err);


More information about the cvs-krb5 mailing list