aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-02-03 12:11:30 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-02-03 12:11:30 +0100
commita97777889328157bb7d06ec618bad16712a9c345 (patch)
tree3ba4405726ee5c9c03a1f6fedfde377d78ef2e67
parent8e74adab0107658e3dc04ed342206272a284f43e (diff)
downloadbusybox-a97777889328157bb7d06ec618bad16712a9c345.tar.gz
ifconfig: fix double free fatal error in INET_sprint
Based on the patch by Zheng Junling <zhengjunling@huawei.com> and Chen Gang <cg.chen@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/interface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/networking/interface.c b/networking/interface.c
index bf7d2b1b4..b0572d04e 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -91,9 +91,9 @@ static const char* FAST_FUNC INET_sprint(struct sockaddr *sap, int numeric)
{
static char *buff; /* defaults to NULL */
- free(buff);
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return "[NONE SET]";
+ free(buff);
buff = INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00);
return buff;
}
@@ -173,9 +173,9 @@ static const char* FAST_FUNC INET6_sprint(struct sockaddr *sap, int numeric)
{
static char *buff;
- free(buff);
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return "[NONE SET]";
+ free(buff);
buff = INET6_rresolve((struct sockaddr_in6 *) sap, numeric);
return buff;
}