mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
malloc-fail: Fix null deref in xmlBufResize
Found with libFuzzer, see #344.
This commit is contained in:
3
buf.c
3
buf.c
@@ -735,7 +735,8 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
if (buf->content == NULL) {
|
||||
rebuf = (xmlChar *) xmlMallocAtomic(newSize);
|
||||
buf->use = 0;
|
||||
rebuf[buf->use] = 0;
|
||||
if (rebuf != NULL)
|
||||
rebuf[buf->use] = 0;
|
||||
} else if (buf->size - buf->use < 100) {
|
||||
rebuf = (xmlChar *) xmlRealloc(buf->content, newSize);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user