Merge pull request #2587 from guidovranken/ocsp-resp-decoder-bounds-fix

Properly limit array access in OCSP response decoder
This commit is contained in:
John Safranek
2019-11-21 10:13:49 -08:00
committed by GitHub

View File

@@ -14790,7 +14790,7 @@ static int GetEnumerated(const byte* input, word32* inOutIdx, int *value,
return BUFFER_E;
len = input[idx++];
if (len > 4 || (int)len > sz)
if (len > 4 || (int)(len + idx) > sz)
return ASN_PARSE_E;
while (len--) {
@@ -14850,6 +14850,9 @@ static int DecodeSingleResponse(byte* source,
if (GetSerialNumber(source, &idx, cs->serial, &cs->serialSz, size) < 0)
return ASN_PARSE_E;
if ( idx >= size )
return BUFFER_E;
/* CertStatus */
switch (source[idx++])
{