diff -Nru wget-1.17.1/debian/changelog wget-1.17.1/debian/changelog --- wget-1.17.1/debian/changelog 2018-05-08 17:00:36.000000000 +0000 +++ wget-1.17.1/debian/changelog 2019-04-08 19:14:27.000000000 +0000 @@ -1,3 +1,12 @@ +wget (1.17.1-1ubuntu1.5) xenial-security; urgency=medium + + * SECURITY UPDATE: Buffer overflow + - debian/patches/CVE-2019-5953-*.patch: fix in + src/iri.c. + - CVE-2019-5953 + + -- Leonidas S. Barbosa Mon, 08 Apr 2019 16:13:54 -0300 + wget (1.17.1-1ubuntu1.4) xenial-security; urgency=medium * SECURITY UPDATE: Cookie injection vulnerability diff -Nru wget-1.17.1/debian/patches/CVE-2019-5953-1.patch wget-1.17.1/debian/patches/CVE-2019-5953-1.patch --- wget-1.17.1/debian/patches/CVE-2019-5953-1.patch 1970-01-01 00:00:00.000000000 +0000 +++ wget-1.17.1/debian/patches/CVE-2019-5953-1.patch 2019-04-08 19:13:42.000000000 +0000 @@ -0,0 +1,41 @@ +From 692d5c5215de0db482c252492a92fc424cc6a97c Mon Sep 17 00:00:00 2001 +From: Tim Ruehsen +Date: Fri, 5 Apr 2019 11:50:44 +0200 +Subject: Fix a buffer overflow vulnerability + +* src/iri.c(do_conversion): Reallocate the output buffer to a larger + size if it is already full +diff --git a/src/iri.c b/src/iri.c +index 2db3180..6ef45bd 100644 +--- a/src/iri.c ++++ b/src/iri.c +@@ -144,8 +144,11 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz + *out = s = xmalloc (outlen + 1); + done = 0; + ++ DEBUGP (("iconv %s -> %s\n", tocode, fromcode)); ++ + for (;;) + { ++ DEBUGP (("iconv outlen=%d inlen=%d\n", outlen, inlen)); + if (iconv (cd, &in, &inlen, out, &outlen) != (size_t)(-1)) + { + *out = s; +@@ -179,11 +182,14 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz + } + else if (errno == E2BIG) /* Output buffer full */ + { ++ logprintf (LOG_VERBOSE, ++ _("Reallocate output buffer len=%d outlen=%d inlen=%d\n"), len, outlen, inlen); + tooshort++; + done = len; +- len = outlen = done + inlen * 2; +- s = xrealloc (s, outlen + 1); +- *out = s + done; ++ len = done + inlen * 2; ++ s = xrealloc (s, len + 1); ++ *out = s + done - outlen; ++ outlen += inlen * 2; + } + else /* Weird, we got an unspecified error */ + { diff -Nru wget-1.17.1/debian/patches/CVE-2019-5953-2.patch wget-1.17.1/debian/patches/CVE-2019-5953-2.patch --- wget-1.17.1/debian/patches/CVE-2019-5953-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ wget-1.17.1/debian/patches/CVE-2019-5953-2.patch 2019-04-08 19:13:47.000000000 +0000 @@ -0,0 +1,31 @@ +From 562eacb76a2b64d5dc80a443f0f739bc9ef76c17 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tim=20R=C3=BChsen?= +Date: Fri, 5 Apr 2019 13:01:57 +0200 +Subject: * src/iri.c (do_conversion): Remove unneeded debug lines + + +diff --git a/src/iri.c b/src/iri.c +index 6ef45bd..3d60d5a 100644 +--- a/src/iri.c ++++ b/src/iri.c +@@ -144,11 +144,8 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz + *out = s = xmalloc (outlen + 1); + done = 0; + +- DEBUGP (("iconv %s -> %s\n", tocode, fromcode)); +- + for (;;) + { +- DEBUGP (("iconv outlen=%d inlen=%d\n", outlen, inlen)); + if (iconv (cd, &in, &inlen, out, &outlen) != (size_t)(-1)) + { + *out = s; +@@ -182,8 +179,6 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz + } + else if (errno == E2BIG) /* Output buffer full */ + { +- logprintf (LOG_VERBOSE, +- _("Reallocate output buffer len=%d outlen=%d inlen=%d\n"), len, outlen, inlen); + tooshort++; + done = len; + len = done + inlen * 2; diff -Nru wget-1.17.1/debian/patches/CVE-2019-5953-pre.patch wget-1.17.1/debian/patches/CVE-2019-5953-pre.patch --- wget-1.17.1/debian/patches/CVE-2019-5953-pre.patch 1970-01-01 00:00:00.000000000 +0000 +++ wget-1.17.1/debian/patches/CVE-2019-5953-pre.patch 2019-04-08 19:13:10.000000000 +0000 @@ -0,0 +1,33 @@ +From cbbeca2af4962a648a2373b35cf8e497e11d90fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tim=20R=C3=BChsen?= +Date: Thu, 17 Dec 2015 17:41:32 +0100 +Subject: [PATCH] Cleanup code + +* src/iri.c (do_conversion): Code cleanup +--- + src/iri.c | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +Index: wget-1.17.1/src/iri.c +=================================================================== +--- wget-1.17.1.orig/src/iri.c ++++ wget-1.17.1/src/iri.c +@@ -179,16 +179,10 @@ do_conversion (const char *tocode, const + } + else if (errno == E2BIG) /* Output buffer full */ + { +- char *new; +- + tooshort++; + done = len; +- outlen = done + inlen * 2; +- new = xmalloc (outlen + 1); +- memcpy (new, s, done); +- xfree (s); +- s = new; +- len = outlen; ++ len = outlen = done + inlen * 2; ++ s = xrealloc (s, outlen + 1); + *out = s + done; + } + else /* Weird, we got an unspecified error */ diff -Nru wget-1.17.1/debian/patches/series wget-1.17.1/debian/patches/series --- wget-1.17.1/debian/patches/series 2018-05-08 16:59:55.000000000 +0000 +++ wget-1.17.1/debian/patches/series 2019-04-08 19:13:47.000000000 +0000 @@ -11,3 +11,6 @@ CVE-2017-13089.patch CVE-2017-13090.patch CVE-2018-0494.patch +CVE-2019-5953-pre.patch +CVE-2019-5953-1.patch +CVE-2019-5953-2.patch