Control: tag -1 + patch

Hello,

On Tue, Oct 25, 2016 at 10:27:24PM +0200, Salvatore Bonaccorso wrote:
> the following vulnerability was published for libupnp. The issue is
> reproducible easily if libupnp compiled with ASAN and following the
> reproducing steps in the upstream bugreport.

I didn't try to reproduce, but I think the following patch (while not
being pretty) is easy and fixes the issue:

diff --git a/upnp/src/gena/gena_device.c b/upnp/src/gena/gena_device.c
index 58a3e55e8973..700f00b449db 100644
--- a/upnp/src/gena/gena_device.c
+++ b/upnp/src/gena/gena_device.c
@@ -1145,7 +1145,11 @@ static int create_url_list(
 
     if( URLcount > 0 ) {
         out->URLs = malloc(URLS->size + 1);
-        out->parsedURLs = malloc(sizeof(uri_type) * URLcount);
+       /*
+        * You wonder why there is a +1? See
+        * https://sourceforge.net/p/pupnp/bugs/133/
+        */
+        out->parsedURLs = malloc(sizeof(uri_type) * (URLcount + 1));
         if (!out->URLs || !out->parsedURLs) {
             free(out->URLs);
             free(out->parsedURLs);

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature

Reply via email to