summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2008-08-07 00:59:29 +0000
committerKen Raeburn <raeburn@mit.edu>2008-08-07 00:59:29 +0000
commitc121e1abc698311b953bc623921758e5c35d3e99 (patch)
tree87e8d8e448a90c11fe37b16455231c5a64ec6d67 /src
parent1d6f2838f3ce45fc1dac399eb15dff1c409a10c1 (diff)
downloadkrb5-c121e1abc698311b953bc623921758e5c35d3e99.tar.gz
krb5-c121e1abc698311b953bc623921758e5c35d3e99.tar.xz
krb5-c121e1abc698311b953bc623921758e5c35d3e99.zip
Pull out EOC error checks into separate functions
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20629 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/krb5/asn.1/asn1_k_decode.c23
-rw-r--r--src/lib/krb5/asn.1/krb5_decode.c23
2 files changed, 34 insertions, 12 deletions
diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c
index ad4539eb9..e1d9bb2db 100644
--- a/src/lib/krb5/asn.1/asn1_k_decode.c
+++ b/src/lib/krb5/asn.1/asn1_k_decode.c
@@ -52,20 +52,31 @@
indef = t2.indef; \
}
+static asn1_error_code
+asn1_get_eoc_tag (asn1buf *buf, taginfo *tinfo)
+{
+ asn1_error_code retval;
+
+ retval = asn1_get_tag_2(buf, tinfo);
+ if (retval)
+ return retval;
+ if (tinfo->asn1class != UNIVERSAL || tinfo->tagnum || tinfo->indef)
+ return ASN1_MISSING_EOC;
+ return 0;
+}
+
/* Force check for EOC tag. */
#define get_eoc() \
{ \
taginfo t3; \
- retval = asn1_get_tag_2(&subbuf, &t3); \
+ retval = asn1_get_eoc_tag(&subbuf, &t3); \
if(retval) return retval; \
- if (t3.asn1class != UNIVERSAL || t3.tagnum || t3.indef) \
- return ASN1_MISSING_EOC; \
/* Copy out to match previous functionality, until better integrated. */ \
- asn1class = t3.asn1class; \
+ asn1class = UNIVERSAL; \
construction = t3.construction; \
- tagnum = t3.tagnum; \
+ tagnum = 0; \
taglen = t3.length; \
- indef = t3.indef; \
+ indef = 0; \
}
#define alloc_field(var, type) \
diff --git a/src/lib/krb5/asn.1/krb5_decode.c b/src/lib/krb5/asn.1/krb5_decode.c
index ea21f7e49..f071cbf52 100644
--- a/src/lib/krb5/asn.1/krb5_decode.c
+++ b/src/lib/krb5/asn.1/krb5_decode.c
@@ -93,17 +93,28 @@ if((var) == NULL) clean_return(ENOMEM)
taglen = t2.length; \
}
+static asn1_error_code
+asn1_get_eoc_tag (asn1buf *buf, taginfo *tinfo)
+{
+ asn1_error_code retval;
+
+ retval = asn1_get_tag_2(buf, tinfo);
+ if (retval)
+ return retval;
+ if (tinfo->asn1class != UNIVERSAL || tinfo->tagnum || tinfo->indef)
+ return ASN1_MISSING_EOC;
+ return 0;
+}
+
#define get_eoc() \
{ \
taginfo t3; \
- retval = asn1_get_tag_2(&subbuf, &t3); \
+ retval = asn1_get_eoc_tag(&subbuf, &t3); \
if (retval) return retval; \
- if (t3.asn1class != UNIVERSAL || t3.tagnum || t3.indef) \
- return ASN1_MISSING_EOC; \
- asn1class = t3.asn1class; \
+ asn1class = UNIVERSAL; \
construction = t3.construction; \
- tagnum = t3.tagnum; \
- indef = t3.indef; \
+ tagnum = 0; \
+ indef = 0; \
}
/* decode sequence header and initialize tagnum with the first field */