From bd203e780e10700b9ef7d941b5023c5f558e445d Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Mon, 5 Mar 2012 11:27:52 +0100 Subject: [PATCH] SF Bug Tracker id 3496934 - Memory leaks in getlocalhostname and UpnpGetIfInfo Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:25:42 PST LocalSock is not closed if ioctl(LocalSock, SIOCGIFCONF, &ifConf); returns an error. --- ChangeLog | 9 +++++++++ upnp/src/api/upnpapi.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89deb38..4f0d830 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,15 @@ Version 1.6.16 ******************************************************************************* +2012-03-05 Fabrice Fontaine + + SF Bug Tracker id 3496934 - Memory leaks in getlocalhostname and UpnpGetIfInfo + + Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:25:42 PST + + LocalSock is not closed if ioctl(LocalSock, SIOCGIFCONF, &ifConf); + returns an error. + 2012-03-05 Fabrice Fontaine SF Bug Tracker id 3496933 - Out-of-bounds access in CheckOtherHTTPHeaders diff --git a/upnp/src/api/upnpapi.c b/upnp/src/api/upnpapi.c index c9b86f5..a0ec0fa 100644 --- a/upnp/src/api/upnpapi.c +++ b/upnp/src/api/upnpapi.c @@ -2,7 +2,7 @@ * * Copyright (c) 2000-2003 Intel Corporation * All rights reserved. - * Copyright (C) 2011 France Telecom All rights reserved. + * Copyright (C) 2011-2012 France Telecom All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -3281,6 +3281,7 @@ int UpnpGetIfInfo(const char *IfName) if (ioctl(LocalSock, SIOCGIFCONF, &ifConf) < 0) { UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, "DiscoverInterfaces: SIOCGIFCONF returned error\n"); + close(LocalSock); return UPNP_E_INIT; } /* Cycle through the list of interfaces looking for IP addresses. */ @@ -3699,7 +3700,7 @@ int getlocalhostname(char *out, size_t out_len) if (nResult < 0) { UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, "DiscoverInterfaces: SIOCGIFCONF returned error\n"); - + close(LocalSock); return UPNP_E_INIT; }