Correct a fencepost in ASN.1 encode_cntype
authorGreg Hudson <ghudson@mit.edu>
Sat, 11 Feb 2012 23:24:52 +0000 (23:24 +0000)
committerGreg Hudson <ghudson@mit.edu>
Sat, 11 Feb 2012 23:24:52 +0000 (23:24 +0000)
For cntype_choice, count must be less than choice->n_options.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25684 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/asn.1/asn1_encode.c

index 48ecc2ff66204ee5de39aa1361256011ab591c88..7385cfa6300fb6c56c3ffcb76a00f28fe7d595d6 100644 (file)
@@ -500,7 +500,7 @@ encode_cntype(asn1buf *buf, const void *val, unsigned int count,
     }
     case cntype_choice: {
         const struct choice_info *choice = c->tinfo;
-        if (count > choice->n_options)
+        if (count >= choice->n_options)
             return ASN1_MISSING_FIELD;
         return krb5int_asn1_encode_type(buf, val, choice->options[count],
                                         rettag);