krb5 commit: Fix FILE ccache negative enctype unmarshalling

Greg Hudson ghudson at mit.edu
Tue Dec 8 18:46:00 EST 2015


https://github.com/krb5/krb5/commit/a585d20701aa7bfcbdc2fe6999d8477c7aa01c3c
commit a585d20701aa7bfcbdc2fe6999d8477c7aa01c3c
Author: Greg Hudson <ghudson at mit.edu>
Date:   Mon Dec 7 23:59:31 2015 -0500

    Fix FILE ccache negative enctype unmarshalling
    
    Commit b99c7c79dee33de966c8bed02ac79439989f6f99 broke the
    unmarshalling of negative enctype values from FILE ccaches.  Fix it by
    sign-extending the 16-bit enctype value in unmarshal_keyblock().

 src/lib/krb5/ccache/ccmarshal.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/ccache/ccmarshal.c b/src/lib/krb5/ccache/ccmarshal.c
index 40eb6a8..bd6d309 100644
--- a/src/lib/krb5/ccache/ccmarshal.c
+++ b/src/lib/krb5/ccache/ccmarshal.c
@@ -198,7 +198,8 @@ unmarshal_keyblock(struct k5input *in, int version, krb5_keyblock *kb)
 {
     memset(kb, 0, sizeof(*kb));
     kb->magic = KV5M_KEYBLOCK;
-    kb->enctype = get16(in, version);
+    /* enctypes can be negative, so sign-extend the 16-bit result. */
+    kb->enctype = (int16_t)get16(in, version);
     /* Version 3 stores the enctype twice. */
     if (version == 3)
         (void)get16(in, version);


More information about the cvs-krb5 mailing list