{
l += xmlp->lcontent + 1; /* plus room for trailing zero */
if (l > xmlp->acontent)
- {
+ {
xmlp->acontent = l + 256;
xmlp->content = solv_realloc(xmlp->content, xmlp->acontent);
- }
+ }
}
{
struct solv_xmlparser *xmlp = userData;
- if (!xmlp->docontent || !len)
+ if (!xmlp->docontent || len <= 0)
return;
+ if ((unsigned int)xmlp->lcontent + (unsigned int)len >= 0x40000000U)
+ return; /* hey! just ignore for now */
add_contentspace(xmlp, len);
memcpy(xmlp->content + xmlp->lcontent, s, len);
xmlp->lcontent += len;
{
xmlp->lcontent = 0;
if (l > xmlp->acontent)
- {
+ {
+ if ((unsigned int)l >= 0x40000000U)
+ solv_oom(0, l);
xmlp->acontent = l + 256;
xmlp->content = solv_realloc(xmlp->content, xmlp->acontent);
- }
+ }
return xmlp->content;
}