I'm going to be using asn1_parse_definite_length outside of the local
functions so add the missing length validation.
---
ell/asn1-private.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ell/asn1-private.h b/ell/asn1-private.h
index 4ba17ac..0c5897a 100644
--- a/ell/asn1-private.h
+++ b/ell/asn1-private.h
@@ -46,8 +46,14 @@ static inline int asn1_parse_definite_length(const uint8_t **buf,
int n;
size_t result = 0;
- (*len)--;
+ /* Decrease the buffer length left */
+ if ((*len)-- < 1)
+ return -1;
+ /*
+ * If short form length, move the pointer to start of data and
+ * return the data length.
+ */
if (!(**buf & 0x80))
return *(*buf)++;
--
2.19.1