From 211b4c89103d9e49f96c2fdbe642b73ffea0bf8e Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 23 Dec 2002 18:10:56 +0000 Subject: [PATCH] * asn1_k_decode.c (asn1_decode_sam_challenge_2_body): Add unused_var declaration to cleanup warnings. Signed/unsigned fix as well. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15068 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/asn.1/ChangeLog | 6 ++++++ src/lib/krb5/asn.1/asn1_k_decode.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 81a841966..533eb9b44 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,3 +1,9 @@ +2002-12-23 Ezra Peisach + + * asn1_k_decode.c (asn1_decode_sam_challenge_2_body): Add + unused_var declaration to cleanup warnings. Signed/unsigned fix as + well. + 2002-11-07 Ezra Peisach * asn1_k_encode.c (asn1_encode_sam_challenge_2): Test for error diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index 0a827b160..0917d71e2 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -816,19 +816,22 @@ asn1_error_code asn1_decode_sam_challenge_2(asn1buf *buf, krb5_sam_challenge_2 * { setup(); { char *save, *end; + size_t alloclen; begin_structure(); if (tagnum != 0) return ASN1_MISSING_FIELD; if (asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) return ASN1_BAD_ID; save = subbuf.next; { sequence_of_no_tagvars(&subbuf); + unused_var(size); end_sequence_of_no_tagvars(&subbuf); } end = subbuf.next; - if ((val->sam_challenge_2_body.data = (char *) malloc(end - save)) == NULL) + alloclen = end - save; + if ((val->sam_challenge_2_body.data = (char *) malloc(alloclen)) == NULL) return ENOMEM; - val->sam_challenge_2_body.length = end - save; - memcpy(val->sam_challenge_2_body.data, save, end - save); + val->sam_challenge_2_body.length = alloclen; + memcpy(val->sam_challenge_2_body.data, save, alloclen); next_tag(); get_field(val->sam_cksum, 1, asn1_decode_sequence_of_checksum); end_structure(); -- 2.26.2