Commit fd884c6b authored by David Kilzer's avatar David Kilzer
Browse files

Fix integer overflow in xmlBufferDump()

* tree.c:
(xmlBufferDump):
- Cap the return value to INT_MAX.
parent fe9f76eb
Pipeline #402483 passed with stage
in 4 minutes and 51 seconds
......@@ -7413,7 +7413,7 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
*/
int
xmlBufferDump(FILE *file, xmlBufferPtr buf) {
int ret;
size_t ret;
if (buf == NULL) {
#ifdef DEBUG_BUFFER
......@@ -7432,7 +7432,7 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
if (file == NULL)
file = stdout;
ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
return(ret);
return(ret > INT_MAX ? INT_MAX : (int)ret);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment