From a585d20701aa7bfcbdc2fe6999d8477c7aa01c3c Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Mon, 7 Dec 2015 23:59:31 -0500 Subject: [PATCH] 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 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/ccache/ccmarshal.c b/src/lib/krb5/ccache/ccmarshal.c index 40eb6a8562..bd6d309d1d 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); -- 2.47.2