diff --git a/libsearch/parser/binary-parser.cpp b/libsearch/parser/binary-parser.cpp index 935b6f5..d2aca65 100644 --- a/libsearch/parser/binary-parser.cpp +++ b/libsearch/parser/binary-parser.cpp @@ -4562,19 +4562,26 @@ static void vName2String(char *szName, const UCHAR *aucBytes, size_t tNameSize) } /* end of vName2String */ -void vAdd2PropModList(const UCHAR *aucPropMod) { +bool vAdd2PropModList(const UCHAR *aucPropMod) { size_t tSize, tLen; if(tNextFree >= tMaxElements) { tMaxElements += ELEMENTS_TO_ADD; tSize = tMaxElements * sizeof(UCHAR **); - ppAnchor = (UCHAR**)xrealloc(ppAnchor, tSize); + void *pvTmp; + pvTmp = realloc(ppAnchor, tSize); + if(pvTmp) { + ppAnchor = (UCHAR**)pvTmp; + } else { + return false; + } } tLen = 2 + (size_t)usGetWord(0, aucPropMod); ppAnchor[tNextFree] = (UCHAR*)xmalloc(tLen); memcpy(ppAnchor[tNextFree], aucPropMod, tLen); tNextFree++; + return true; } /* end of vAdd2PropModList */ static void vComputePPSlevels(ppsEntryType *atPPSlist, ppsEntryType *pNode, @@ -4940,7 +4947,9 @@ bool KBinaryParser::read8DocText(FILE *pFile, const ppsInfoType *pPPS, } if(iType == 1) { iLen = (int)usGetWord(lOff, aucBuffer); - vAdd2PropModList(aucBuffer + lOff); + if(!vAdd2PropModList(aucBuffer + lOff)) { + return false; + } lOff += (long)iLen + 2; continue; }