Fix asn1_encode_subject_pk_info without params
authorGreg Hudson <ghudson@mit.edu>
Fri, 6 Jan 2012 20:46:17 +0000 (20:46 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 6 Jan 2012 20:46:17 +0000 (20:46 +0000)
r20923 inadvertently broke asn1_encode_subject_pk_info in the case
where algorithm.parameters.length == 0.  Fortunately this case never
happens, but fix it anyway.

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

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

index 82f99b12b630a94eef6daac85f938640b2e6dc5c..8aecfdf564aa051edc8be3c613727913ae20b783 100644 (file)
@@ -1762,13 +1762,15 @@ asn1_encode_subject_pk_info(asn1buf *buf, const krb5_subject_pk_info *val,
     }
 
     if (val->algorithm.parameters.length != 0) {
-        unsigned int length;
-
         retval = asn1buf_insert_octetstring(buf, val->algorithm.parameters.length,
                                             val->algorithm.parameters.data);
         if (retval)
             return retval;
         sum += val->algorithm.parameters.length;
+    }
+
+    {
+        unsigned int length;
 
         retval = asn1_encode_oid(buf, val->algorithm.algorithm.length,
                                  val->algorithm.algorithm.data,