Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

miniupnpc: Backport minixml fixes for CVE-2026-110655 and CVE-2026-110656

Rémi Verschelde5daecee37930
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 4731c7d31b8..e5463ae0fdd 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -778,6 +778,12 @@ Files extracted from upstream source:
- `src/miniupnpcstrings.h` was created manually for Godot (it is usually generated
by CMake). Bump the version number for miniupnpc in that file when upgrading.
+Patches:
+
+- `0001-minixml-fix-buffer-read-overflow.patch` ([GH-124962](https://github.com/godotengine/godot/pull/124962))
+- `0002-minixml-fix-buffer-overrun-after-namespace-separator.patch` ([GH-124962](https://github.com/godotengine/godot/pull/124962))
+- `0003-minixml-fix-1-byte-out-of-bounds-read.patch` ([GH-124962](https://github.com/godotengine/godot/pull/124962))
+
## minizip
diff --git a/thirdparty/miniupnpc/patches/0001-minixml-fix-buffer-read-overflow.patch b/thirdparty/miniupnpc/patches/0001-minixml-fix-buffer-read-overflow.patch
new file mode 100644
index 00000000000..2ac4503d378
--- /dev/null
+++ b/thirdparty/miniupnpc/patches/0001-minixml-fix-buffer-read-overflow.patch
@@ -0,0 +1,36 @@
+diff --git a/thirdparty/miniupnpc/src/minixml.c b/thirdparty/miniupnpc/src/minixml.c
+index 935ec443e7..b102f83538 100644
+--- a/thirdparty/miniupnpc/src/minixml.c
++++ b/thirdparty/miniupnpc/src/minixml.c
+@@ -2,10 +2,10 @@
+ /* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * minixml.c : the minimum size a xml parser can be ! */
+ /* Project : miniupnp
+- * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
++ * webpage: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
+ * Author : Thomas Bernard
+
+-Copyright (c) 2005-2017, Thomas BERNARD
++Copyright (c) 2005-2026, Thomas BERNARD
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+@@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ #include <string.h>
+ #include "minixml.h"
+
+-/* parseatt : used to parse the argument list
++/* parseatt : used to parse the attribute list
+ * return 0 (false) in case of success and -1 (true) if the end
+ * of the xmlbuffer is reached. */
+ static int parseatt(struct xmlparser * p)
+@@ -63,6 +63,9 @@ static int parseatt(struct xmlparser * p)
+ if(p->xml >= p->xmlend)
+ return -1;
+ }
++ /* p->xml points now to the character right after the '=' */
++ if(p->xml >= p->xmlend)
++ return -1;
+ while(IS_WHITE_SPACE(*p->xml))
+ {
+ p->xml++;
diff --git a/thirdparty/miniupnpc/patches/0002-minixml-fix-buffer-overrun-after-namespace-separator.patch b/thirdparty/miniupnpc/patches/0002-minixml-fix-buffer-overrun-after-namespace-separator.patch
new file mode 100644
index 00000000000..c58c05dbf3c
--- /dev/null
+++ b/thirdparty/miniupnpc/patches/0002-minixml-fix-buffer-overrun-after-namespace-separator.patch
@@ -0,0 +1,13 @@
+diff --git a/thirdparty/miniupnpc/src/minixml.c b/thirdparty/miniupnpc/src/minixml.c
+index b102f83538..3b3d0fa8df 100644
+--- a/thirdparty/miniupnpc/src/minixml.c
++++ b/thirdparty/miniupnpc/src/minixml.c
+@@ -145,6 +145,8 @@ static void parseelt(struct xmlparser * p)
+ {
+ i = 0;
+ elementname = ++p->xml;
++ if (p->xml >= p->xmlend)
++ return;
+ }
+ }
+ if(i>0)
diff --git a/thirdparty/miniupnpc/patches/0003-minixml-fix-1-byte-out-of-bounds-read.patch b/thirdparty/miniupnpc/patches/0003-minixml-fix-1-byte-out-of-bounds-read.patch
new file mode 100644
index 00000000000..b823c3c3cf7
--- /dev/null
+++ b/thirdparty/miniupnpc/patches/0003-minixml-fix-1-byte-out-of-bounds-read.patch
@@ -0,0 +1,13 @@
+diff --git a/thirdparty/miniupnpc/src/minixml.c b/thirdparty/miniupnpc/src/minixml.c
+index 3b3d0fa8df..eba7557d7b 100644
+--- a/thirdparty/miniupnpc/src/minixml.c
++++ b/thirdparty/miniupnpc/src/minixml.c
+@@ -197,7 +197,7 @@ static void parseelt(struct xmlparser * p)
+ if ((p->xml + 1) >= p->xmlend)
+ return;
+ }
+- if(i>0 && p->datafunc && *(p->xml + 1) == '/')
++ if(i>0 && p->datafunc && (p->xml + 1) < p->xmlend && *(p->xml + 1) == '/')
+ p->datafunc(p->data, data, i);
+ }
+ }
diff --git a/thirdparty/miniupnpc/src/minixml.c b/thirdparty/miniupnpc/src/minixml.c
index 935ec443e70..eba7557d7b9 100644
--- a/thirdparty/miniupnpc/src/minixml.c
+++ b/thirdparty/miniupnpc/src/minixml.c
@@ -2,10 +2,10 @@
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* minixml.c : the minimum size a xml parser can be ! */
/* Project : miniupnp
- * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * webpage: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
* Author : Thomas Bernard
-Copyright (c) 2005-2017, Thomas BERNARD
+Copyright (c) 2005-2026, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string.h>
#include "minixml.h"
-/* parseatt : used to parse the argument list
+/* parseatt : used to parse the attribute list
* return 0 (false) in case of success and -1 (true) if the end
* of the xmlbuffer is reached. */
static int parseatt(struct xmlparser * p)
@@ -63,6 +63,9 @@ static int parseatt(struct xmlparser * p)
if(p->xml >= p->xmlend)
return -1;
}
+ /* p->xml points now to the character right after the '=' */
+ if(p->xml >= p->xmlend)
+ return -1;
while(IS_WHITE_SPACE(*p->xml))
{
p->xml++;
@@ -142,6 +145,8 @@ static void parseelt(struct xmlparser * p)
{
i = 0;
elementname = ++p->xml;
+ if (p->xml >= p->xmlend)
+ return;
}
}
if(i>0)
@@ -192,7 +197,7 @@ static void parseelt(struct xmlparser * p)
if ((p->xml + 1) >= p->xmlend)
return;
}
- if(i>0 && p->datafunc && *(p->xml + 1) == '/')
+ if(i>0 && p->datafunc && (p->xml + 1) < p->xmlend && *(p->xml + 1) == '/')
p->datafunc(p->data, data, i);
}
}