From: Ken Raeburn Date: Tue, 16 Dec 2003 19:21:49 +0000 (+0000) Subject: * conv_creds.c (krb5int_encode_v4tkt): Zero out unused parts of ticket. Use a X-Git-Tag: krb5-1.4-beta1~694 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0ebeed464fc17f5912694b8942d8420dca15d420;p=krb5.git * conv_creds.c (krb5int_encode_v4tkt): Zero out unused parts of ticket. Use a temorary in case krb5_int32 isn't "int". (decode_v4tkt): Use a temorary in case krb5_int32 isn't "int". git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15936 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 11e840b6b..0a1ada7fb 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,9 @@ +2003-12-16 Ken Raeburn + + * conv_creds.c (krb5int_encode_v4tkt): Zero out unused parts of + ticket. Use a temorary in case krb5_int32 isn't "int". + (decode_v4tkt): Use a temorary in case krb5_int32 isn't "int". + 2003-12-13 Ken Raeburn * mk_req_ext.c (krb5int_generate_and_save_subkey): New function, diff --git a/src/lib/krb5/krb/conv_creds.c b/src/lib/krb5/krb/conv_creds.c index 3a4e66dc5..6d4c109f1 100644 --- a/src/lib/krb5/krb/conv_creds.c +++ b/src/lib/krb5/krb/conv_creds.c @@ -186,14 +186,19 @@ int krb5int_encode_v4tkt(v4tkt, buf, encoded_len) unsigned int *encoded_len; { int buflen, ret; + krb5_int32 temp; buflen = *encoded_len; - if ((ret = encode_int32(&buf, &buflen, &v4tkt->length))) + if (v4tkt->length < MAX_KTXT_LEN) + memset(v4tkt->dat + v4tkt->length, 0, MAX_KTXT_LEN - v4tkt->length); + temp = v4tkt->length; + if ((ret = encode_int32(&buf, &buflen, &temp))) return ret; if ((ret = encode_bytes(&buf, &buflen, (char *)v4tkt->dat, MAX_KTXT_LEN))) return ret; - if ((ret = encode_int32(&buf, &buflen, (krb5_int32 *) &v4tkt->mbz))) + temp = v4tkt->mbz; + if ((ret = encode_int32(&buf, &buflen, &temp))) return ret; *encoded_len -= buflen; @@ -236,14 +241,17 @@ static int decode_v4tkt(v4tkt, buf, encoded_len) unsigned int *encoded_len; { int buflen, ret; + krb5_int32 temp; buflen = *encoded_len; - if ((ret = decode_int32(&buf, &buflen, &v4tkt->length))) + if ((ret = decode_int32(&buf, &buflen, &temp))) return ret; + v4tkt->length = temp; if ((ret = decode_bytes(&buf, &buflen, (char *)v4tkt->dat, MAX_KTXT_LEN))) return ret; - if ((ret = decode_int32(&buf, &buflen, (krb5_int32 *) &v4tkt->mbz))) + if ((ret = decode_int32(&buf, &buflen, &temp))) return ret; + v4tkt->mbz = temp; *encoded_len -= buflen; return 0; }