help-libtasn1
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] Call ordering functions with the right length


From: Kurt Roeckx
Subject: [PATCH 1/4] Call ordering functions with the right length
Date: Sun, 20 Apr 2014 16:50:00 +0200

We're going to insert the length of the set and at this point are going to order
it.  But we called it with the wrong length.  Also updates the check to only do
it when the buffer isn't to small.
---
 lib/coding.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/coding.c b/lib/coding.c
index 70cd14f..705f8b1 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -1167,7 +1167,7 @@ asn1_der_coding (asn1_node element, const char *name, 
void *ider, int *len,
              len2 = _asn1_strtol (p->value, NULL, 10);
              _asn1_set_value (p, NULL, 0);
              if ((type_field (p->type) == ASN1_ETYPE_SET) && (max_len >= 0))
-               _asn1_ordering_set (der + len2, max_len - len2, p);
+               _asn1_ordering_set (der + len2, counter - len2, p);
              asn1_length_der (counter - len2, temp, &len3);
              max_len -= len3;
              if (max_len >= 0)
@@ -1207,7 +1207,7 @@ asn1_der_coding (asn1_node element, const char *name, 
void *ider, int *len,
              len2 = _asn1_strtol (p->value, NULL, 10);
              _asn1_set_value (p, NULL, 0);
              if ((type_field (p->type) == ASN1_ETYPE_SET_OF)
-                 && (max_len - len2 > 0))
+                 && (counter - len2 > 0) && (max_len >= 0))
                {
                  _asn1_ordering_set_of (der + len2, max_len - len2, p);
                }
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]