From 63a3b8f500b17297d513cd03e4be84fbaee40823 Mon Sep 17 00:00:00 2001 From: Masakazu Kitajo Date: Fri, 5 Feb 2021 11:51:16 +0900 Subject: [PATCH] Fix out of bounds access error in ats_base64_decode --- src/tscore/ink_base64.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }