From: Tom Yu Date: Sun, 4 Jul 1999 00:44:07 +0000 (+0000) Subject: * asn1buf.c (asn1buf_sync): Add length parameter to disambiguate X-Git-Tag: krb5-1.1-beta1~79 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b42c394763a1c59cfa5f8260db9e481c0c521e96;p=krb5.git * asn1buf.c (asn1buf_sync): Add length parameter to disambiguate constructed-indefinite encoding from constructed-definite encoding which happens to end at the same place as the enclosing buf. * asn1buf.h: Update to match definition. * krb5_decode.c (end_structure): Update to deal with additional length parameter to asn1buf_sync(). * asn1_k_decode.c (end_sequence_of, end_structure): Update to deal with additional length parameter to asn1buf_sync(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11542 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 4b4d31847..d66129f8b 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,5 +1,17 @@ 1999-07-03 Tom Yu + * asn1buf.c (asn1buf_sync): Add length parameter to disambiguate + constructed-indefinite encoding from constructed-definite encoding + which happens to end at the same place as the enclosing buf. + + * asn1buf.h: Update to match definition. + + * krb5_decode.c (end_structure): Update to deal with additional + length parameter to asn1buf_sync(). + + * asn1_k_decode.c (end_sequence_of, end_structure): Update to deal + with additional length parameter to asn1buf_sync(). + * asn1buf.h: New prototpyes for asn1buf_sync() and asn1buf_skiptail(). diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index 875db9ade..2ecb1c342 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -98,7 +98,7 @@ if(retval) return retval;\ next_tag() #define end_structure()\ -retval = asn1buf_sync(buf,&subbuf,tagnum);\ +retval = asn1buf_sync(buf,&subbuf,tagnum,length);\ if(retval) return retval #define sequence_of(buf)\ @@ -111,7 +111,7 @@ retval = asn1buf_imbed(&seqbuf,buf,length);\ if(retval) return retval #define end_sequence_of(buf)\ -retval = asn1buf_sync(buf,&seqbuf,ASN1_TAGNUM_CEILING);\ +retval = asn1buf_sync(buf,&seqbuf,ASN1_TAGNUM_CEILING,length);\ if(retval) return retval #define cleanup()\ diff --git a/src/lib/krb5/asn.1/asn1buf.c b/src/lib/krb5/asn.1/asn1buf.c index 648626ee5..6d7a950b9 100644 --- a/src/lib/krb5/asn.1/asn1buf.c +++ b/src/lib/krb5/asn.1/asn1buf.c @@ -90,14 +90,15 @@ asn1_error_code asn1buf_imbed(subbuf, buf, length) return 0; } -asn1_error_code asn1buf_sync(buf, subbuf, lasttag) +asn1_error_code asn1buf_sync(buf, subbuf, lasttag, length) asn1buf * buf; asn1buf * subbuf; - asn1_tagnum lasttag; + const asn1_tagnum lasttag; + const int length; { asn1_error_code retval; - if (subbuf->bound != buf->bound) { + if (length) { buf->next = subbuf->bound + 1; } else { /* diff --git a/src/lib/krb5/asn.1/asn1buf.h b/src/lib/krb5/asn.1/asn1buf.h index 1d7373ed0..bf2f252a3 100644 --- a/src/lib/krb5/asn.1/asn1buf.h +++ b/src/lib/krb5/asn.1/asn1buf.h @@ -120,7 +120,8 @@ asn1_error_code asn1buf_imbed position starts at the beginning of *subbuf. */ asn1_error_code asn1buf_sync - PROTOTYPE((asn1buf *buf, asn1buf *subbuf, asn1_tagnum lasttag)); + PROTOTYPE((asn1buf *buf, asn1buf *subbuf, const asn1_tagnum lasttag, + const int length)); /* requires *subbuf is a sub-buffer of *buf, as created by asn1buf_imbed. lasttag is a pointer to the last tagnumber read. effects Synchronizes *buf's current position to match that of *subbuf. */ diff --git a/src/lib/krb5/asn.1/krb5_decode.c b/src/lib/krb5/asn.1/krb5_decode.c index b0fe3160d..ee88b84cc 100644 --- a/src/lib/krb5/asn.1/krb5_decode.c +++ b/src/lib/krb5/asn.1/krb5_decode.c @@ -91,7 +91,7 @@ if(retval) clean_return(retval);\ next_tag() #define end_structure()\ -retval = asn1buf_sync(&buf,&subbuf,tagnum);\ +retval = asn1buf_sync(&buf,&subbuf,tagnum,length);\ if (retval) clean_return(retval) /* process fields *******************************************/