]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix FILE ccache negative enctype unmarshalling 362/head
authorGreg Hudson <ghudson@mit.edu>
Tue, 8 Dec 2015 04:59:31 +0000 (23:59 -0500)
committerGreg Hudson <ghudson@mit.edu>
Tue, 8 Dec 2015 23:37:03 +0000 (18:37 -0500)
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

index 40eb6a8562bf8d0771c5067741ff183ff5b0d074..bd6d309d1d4e2d445eef45ca947b55c6855b5410 100644 (file)
@@ -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);