[PATCH v3] ifconfig: fix double free fatal error in INET_sprint
Denys Vlasenko
vda.linux at googlemail.com
Tue Feb 3 11:14:30 UTC 2015
On Tue, Feb 3, 2015 at 10:12 AM, Zheng Junling <zhengjunling at huawei.com> wrote:
> --- a/networking/interface.c
> +++ b/networking/interface.c
> @@ -92,6 +92,7 @@ static const char* FAST_FUNC INET_sprint(struct sockaddr *sap, int numeric)
> static char *buff; /* defaults to NULL */
>
> free(buff);
> + buff = NULL;
> if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
> return "[NONE SET]";
> buff = INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00);
> @@ -174,6 +175,7 @@ static const char* FAST_FUNC INET6_sprint(struct sockaddr *sap, int numeric)
> static char *buff;
>
> free(buff);
> + buff = NULL;
> if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
> return "[NONE SET]";
> buff = INET6_rresolve((struct sockaddr_in6 *) sap, numeric);
Thanks for finding it!
I am going for a different way to fix it: I'll just move free()
two lines down.
More information about the busybox
mailing list