From f9db6c1b1bf478c331ace18d481ea608ce7de868 Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Mon, 5 Dec 2022 15:46:33 +0800 Subject: [PATCH] =?UTF-8?q?fixed=204c14613=20from=20https://gitee.com/fang?= =?UTF-8?q?-yunzhong/third=5Fparty=5Flibxml2/pulls/34=20fixed=20abceb70=20?= =?UTF-8?q?from=20https://gitee.com/fang-yunzhong/third=5Fparty=5Flibxml2/?= =?UTF-8?q?pulls/33=20=E5=AE=89=E5=85=A8=E6=BC=8F=E6=B4=9E[CVE-2022-29824]?= =?UTF-8?q?=20=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buf.c b/buf.c index c7e5100..ab7c402 100644 --- a/buf.c +++ b/buf.c @@ -172,8 +172,8 @@ xmlBufCreateSize(size_t size) { ret->error = 0; ret->buffer = NULL; ret->alloc = xmlBufferAllocScheme; - ret->size = (size ? size+1 : 0); /* +1 for ending null */ - ret->compat_size = (int) ret->size; + ret->size = (size ? size + 1 : 0); /* +1 for ending null */ + ret->compat_size = (ret->size > INT_MAX ? INT_MAX : ret->size); if (ret->size){ ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); if (ret->content == NULL) { -- Gitee