aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/asn.1/asn1_get.c
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2000-10-26 22:58:13 +0000
committerTom Yu <tlyu@mit.edu>2000-10-26 22:58:13 +0000
commitb5e198d5a487d71d92acf3cd2475071fd559554e (patch)
treea166086adb28a8b2235c0ae8471ed5aa29b03831 /src/lib/krb5/asn.1/asn1_get.c
parentf6ee7cc309306bef489b75f3c70e239b78ddeecc (diff)
downloadkrb5-b5e198d5a487d71d92acf3cd2475071fd559554e.zip
krb5-b5e198d5a487d71d92acf3cd2475071fd559554e.tar.gz
krb5-b5e198d5a487d71d92acf3cd2475071fd559554e.tar.bz2
* asn1buf.c (asn1buf_sync): Add new arguments to include the full
complement of data about a prefetched tag, as well as to indicate whether the prefetched tag or the surrounding sequence is of an indefinite length. (asn1buf_skiptail): Add new arguments to indicate whether the prefetched tag is indefinite, as well as its length. This facilitates proper skipping of trailing garbage. (asn1buf_remains): Add new argument to indicate whether the surrounding encoding is indefinite. Don't advance buf->next if an EOC encoding is detected; the caller will do that. * asn1buf.h: Update prototypes. * asn1_get.c (asn1_get_tag_indef): Don't treat EOC encoding as special anymore, since previous behavior was overloading the tag number in a bad way. Also, report a MISMATCH_INDEF error if the tag encoding is for the forbidden primitive constructed encoding. * asn1_k_decode.c (next_tag): Call get_tag_indef() in order to get information about whether the length is indefinite. Don't check the tag class and construction explicitly. (get_eoc): New macro to get a tag and check if it is an EOC encoding. (get_field, opt_field): Move the check for the tag class and construction to here. (get_field_body, get_lenfield_body): Call get_eoc() instead of next_tag() if we are decoding a constructed indefinite encoding. (begin_structure): Use a different variable to indicate whether the sequence is indefinite as opposed to whether an individual field is indefinite. (end_structure): Update to new calling convention of asn1buf_sync(). (sequence_of): Rewrite significantly. (sequence_of_common): Move the bulk of previous sequence_of() macro to here. Does not declare some variables that sequence_of() declares. (sequence_of_no_tagvars): Similar to sequence_of() macro but declares different variables for the purpose of prefetching the final tag. (end_sequence_of_no_tagvars): Similar to end_sequence_of() macro but uses variables declared by the sequence_of_no_tagvars() macro to prefetch the final tag. (asn1_decode_principal_name): Update for new asn1buf_remains() calling convention. Call sequence_of_no_tagvars(), etc. instead of sequence_of(), etc. in order to not declare shadowing block-local variables. (decode_array_body): Update for new asn1buf_remains() calling convention. (asn1_decode_sequence_of_enctype): Update for new asn1buf_remains() calling convention. * krb5_decode.c (next_tag): Call get_tag_indef() in order to get information about whether the length is indefinite. Don't check the tag class and construction explicitly. (get_eoc): New macro to get a tag and check if it is an EOC encoding. (get_field, opt_field): Move the check for the tag class and construction to here. (get_field_body, get_lenfield_body): Call get_eoc() instead of next_tag() if we are decoding a constructed indefinite encoding. (begin_structure): Use a different variable to indicate whether the sequence is indefinite as opposed to whether an individual field is indefinite. (end_structure): Update to new calling convention of asn1buf_sync(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12816 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/asn.1/asn1_get.c')
-rw-r--r--src/lib/krb5/asn.1/asn1_get.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/krb5/asn.1/asn1_get.c b/src/lib/krb5/asn.1/asn1_get.c
index b233a1a..fc945f1 100644
--- a/src/lib/krb5/asn.1/asn1_get.c
+++ b/src/lib/krb5/asn.1/asn1_get.c
@@ -42,17 +42,13 @@ asn1_get_tag_indef(buf, class, construction, tagnum, retlen, indef)
*tagnum = ASN1_TAGNUM_CEILING;
return 0;
}
- /* Allow for the indefinite encoding */
- if ((buf->bound - buf->next + 1 >= 2)
- && !*(buf->next) && !*(buf->next + 1)) {
- buf->next += 2;
- *tagnum = ASN1_TAGNUM_CEILING;
- return 0;
- }
retval = asn1_get_id(buf,class,construction,tagnum);
if(retval) return retval;
retval = asn1_get_length(buf,retlen,indef);
if(retval) return retval;
+ if (indef != NULL && *indef &&
+ construction != NULL && *construction != CONSTRUCTED)
+ return ASN1_MISMATCH_INDEF;
return 0;
}