From d457ff8d71609c9470f6c72bd909ea08f118fe07 Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 10 Oct 2014 10:25:42 -0700 Subject: [PATCH] don't set GetLength input value to negative in error case, shouldn't matter if return value checked --- ctaocrypt/src/asn.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index a2b7e477d..20d816264 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -424,6 +424,8 @@ CYASSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len, word32 i = *inOutIdx; byte b; + *len = 0; /* default length */ + if ( (i+1) > maxIdx) { /* for first read */ CYASSL_MSG("GetLength bad index on input"); return BUFFER_E; @@ -452,7 +454,8 @@ CYASSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len, } *inOutIdx = i; - *len = length; + if (length > 0) + *len = length; return length; }