1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-12 16:58:16 +03:00

malloc-fail: Fix use-after-free in xmlBufBackToBuffer

This commit is contained in:
Nick Wellnhofer 2024-03-04 01:25:46 +01:00
parent edbf1eb63b
commit 9c2d451c02

11
buf.c
View File

@ -863,12 +863,19 @@ xmlBufBackToBuffer(xmlBufPtr buf) {
if (buf == NULL)
return(NULL);
CHECK_COMPAT(buf)
if ((buf->error) || (buf->buffer == NULL)) {
ret = buf->buffer;
if ((buf->error) || (ret == NULL)) {
xmlBufFree(buf);
if (ret != NULL) {
ret->content = NULL;
ret->contentIO = NULL;
ret->use = 0;
ret->size = 0;
}
return(NULL);
}
ret = buf->buffer;
/*
* What to do in case of error in the buffer ???
*/