diff --git a/src/tscore/ink_base64.cc b/src/tscore/ink_base64.cc index 22cb11fefec..a1da352f36e 100644 --- a/src/tscore/ink_base64.cc +++ b/src/tscore/ink_base64.cc @@ -136,7 +136,7 @@ ats_base64_decode(const char *inBuffer, size_t inBufferSize, unsigned char *outB // Ignore any trailing ='s or other undecodable characters. // TODO: Perhaps that ought to be an error instead? - while (printableToSixBit[static_cast(inBuffer[inBytes])] <= MAX_PRINT_VAL) { + while (inBytes < inBufferSize && printableToSixBit[static_cast(inBuffer[inBytes])] <= MAX_PRINT_VAL) { ++inBytes; }