fix out of bounds read in PemToDer with 0 size der buffer, CU #4

This commit is contained in:
Chris Conlon
2016-06-24 14:42:06 -06:00
parent 92e501c8e4
commit 9c7bea46d2

View File

@ -3551,7 +3551,7 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
/* set up der buffer */
neededSz = (long)(footerEnd - headerEnd);
if (neededSz > sz || neededSz < 0)
if (neededSz > sz || neededSz <= 0)
return SSL_BAD_FILE;
ret = AllocDer(pDer, (word32)neededSz, type, heap);