gnu: miniupnpc: Fix CVE-2017-8798.

* gnu/packages/patches/miniupnpc-CVE-2017-8798.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/upnp.scm (miniupnpc)[source]: Use it.
This commit is contained in:
Marius Bakke 2017-05-12 00:32:41 +02:00
parent 2253477e6f
commit d231fe0a9b
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
3 changed files with 57 additions and 0 deletions

View File

@ -807,6 +807,7 @@ dist_patch_DATA = \
%D%/packages/patches/mesa-wayland-egl-symbols-check-mips.patch \ %D%/packages/patches/mesa-wayland-egl-symbols-check-mips.patch \
%D%/packages/patches/metabat-remove-compilation-date.patch \ %D%/packages/patches/metabat-remove-compilation-date.patch \
%D%/packages/patches/mhash-keygen-test-segfault.patch \ %D%/packages/patches/mhash-keygen-test-segfault.patch \
%D%/packages/patches/miniupnpc-CVE-2017-8798.patch \
%D%/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch \ %D%/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch \
%D%/packages/patches/mpc123-initialize-ao.patch \ %D%/packages/patches/mpc123-initialize-ao.patch \
%D%/packages/patches/module-init-tools-moduledir.patch \ %D%/packages/patches/module-init-tools-moduledir.patch \

View File

@ -0,0 +1,55 @@
Fix CVE-2017-8798.
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8798
http://seclists.org/oss-sec/2017/q2/247
Patch copied from upstream source repository, with Changelog entry removed:
https://github.com/miniupnp/miniupnp/commit/f0f1f4b22d6a98536377a1bb07e7c20e4703d229
diff --git a/miniwget.c b/miniwget.c
index 37cb47b..1eda57c 100644
--- a/miniwget.c
+++ b/miniwget.c
@@ -284,11 +284,12 @@ getHTTPResponse(int s, int * size, int * status_code)
goto end_of_stream;
}
}
- bytestocopy = ((int)chunksize < (n - i))?chunksize:(unsigned int)(n - i);
+ /* it is guaranteed that (n >= i) */
+ bytestocopy = (chunksize < (unsigned int)(n - i))?chunksize:(unsigned int)(n - i);
if((content_buf_used + bytestocopy) > content_buf_len)
{
char * tmp;
- if(content_length >= (int)(content_buf_used + bytestocopy)) {
+ if((content_length >= 0) && ((unsigned int)content_length >= (content_buf_used + bytestocopy))) {
content_buf_len = content_length;
} else {
content_buf_len = content_buf_used + bytestocopy;
@@ -313,14 +314,15 @@ getHTTPResponse(int s, int * size, int * status_code)
{
/* not chunked */
if(content_length > 0
- && (int)(content_buf_used + n) > content_length) {
+ && (content_buf_used + n) > (unsigned int)content_length) {
/* skipping additional bytes */
n = content_length - content_buf_used;
}
if(content_buf_used + n > content_buf_len)
{
char * tmp;
- if(content_length >= (int)(content_buf_used + n)) {
+ if(content_length >= 0
+ && (unsigned int)content_length >= (content_buf_used + n)) {
content_buf_len = content_length;
} else {
content_buf_len = content_buf_used + n;
@@ -340,7 +342,7 @@ getHTTPResponse(int s, int * size, int * status_code)
}
}
/* use the Content-Length header value if available */
- if(content_length > 0 && (int)content_buf_used >= content_length)
+ if(content_length > 0 && content_buf_used >= (unsigned int)content_length)
{
#ifdef DEBUG
printf("End of HTTP content\n");

View File

@ -34,6 +34,7 @@
(method url-fetch) (method url-fetch)
(uri (string-append "https://miniupnp.tuxfamily.org/files/" (uri (string-append "https://miniupnp.tuxfamily.org/files/"
name "-" version ".tar.gz")) name "-" version ".tar.gz"))
(patches (search-patches "miniupnpc-CVE-2017-8798.patch"))
(sha256 (sha256
(base32 "0n11m2wq812zms5b21h8ihw1kbyaihj9nqjiida0hskf4dmw4m13")))) (base32 "0n11m2wq812zms5b21h8ihw1kbyaihj9nqjiida0hskf4dmw4m13"))))
(build-system gnu-build-system) (build-system gnu-build-system)