Additional length check improvements in Base64_SkipNewline

This commit is contained in:
Guido Vranken
2021-06-09 19:16:07 +02:00
parent d8cd7cbee1
commit fb366f063e

View File

@ -117,10 +117,18 @@ static WC_INLINE int Base64_SkipNewline(const byte* in, word32 *inLen, word32 *o
{
word32 len = *inLen;
word32 j = *outJ;
byte curChar = in[j];
byte curChar;
if (len == 0) {
return BUFFER_E;
}
curChar = in[j++];
len--;
while (len && curChar == ' ') {
/* skip whitespace in the middle or end of line */
curChar = in[++j];
curChar = in[j++];
len--;
}
if (len && (curChar == '\r' || curChar == '\n')) {