From owner-freebsd-hackers Fri Nov 17 06:51:54 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id GAA07483 for hackers-outgoing; Fri, 17 Nov 1995 06:51:54 -0800 Received: from tfs.com (tfs.com [140.145.250.1]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id GAA07476 for ; Fri, 17 Nov 1995 06:51:47 -0800 Received: from critter.tfs.com by tfs.com (smail3.1.28.1) with SMTP id m0tGS8V-0003wVC; Fri, 17 Nov 95 06:51 PST Received: from localhost (localhost [127.0.0.1]) by critter.tfs.com (8.6.11/8.6.9) with SMTP id NAA01575; Fri, 17 Nov 1995 13:52:45 +0100 X-Authentication-Warning: critter.tfs.com: Host localhost didn't use HELO protocol To: grog@lemis.de (Greg Lehey) cc: hackers@freebsd.org (FreeBSD Hackers) Subject: Re: mountd(8) performs illegal free() In-reply-to: Your message of "Fri, 17 Nov 1995 12:50:50 +0100." <199511171150.MAA25180@allegro.lemis.de> Date: Fri, 17 Nov 1995 13:52:44 +0100 Message-ID: <1573.816612764@critter.tfs.com> From: Poul-Henning Kamp Sender: owner-hackers@freebsd.org Precedence: bulk > 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.