Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Nov 1995 13:52:44 +0100
From:      Poul-Henning Kamp <phk@critter.tfs.com>
To:        grog@lemis.de (Greg Lehey)
Cc:        hackers@freebsd.org (FreeBSD Hackers)
Subject:   Re: mountd(8) performs illegal free() 
Message-ID:  <1573.816612764@critter.tfs.com>
In-Reply-To: Your message of "Fri, 17 Nov 1995 12:50:50 %2B0100." <199511171150.MAA25180@allegro.lemis.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
> In the last few -current releases, I've had the message
> 
>   Malloc warning: free(): junk pointer (too high)
> 
> at system startup.  It comes from mountd, and it's wrong: the address
> being freed is in the text segment.
> 
> Is this intentional?  Should free(3) even try to accept this sort of
> behaviour?  In any case, it's easy enough to fix:

This is another victory for phkmalloc.  :->

Well, this free(3) will detect it, complain about it and then ignore it.

Poul-Henning
> 
> --- mountd.c    1995/06/27 11:06:19     1.9
> +++ mountd.c    1995/11/17 11:44:06
> @@ -885,7 +885,8 @@
>                         hpe = (struct hostent *)malloc(sizeof(struct hostent)
);
>                         if (hpe == (struct hostent *)NULL)
>                                 out_of_mem();
> -                       hpe->h_name = "Default";
> +                       hpe->h_name = malloc (16);
> +                       strcpy (hpe->h_name, "Default");
>                         hpe->h_addrtype = AF_INET;
>                         hpe->h_length = sizeof (u_long);
>                         hpe->h_addr_list = (char **)NULL;
> 
> 
> Greg
> 
> 

--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Future will arrive by its own means, progress not so.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1573.816612764>