From owner-freebsd-hackers Fri Nov 17 03:53:40 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id DAA27774 for hackers-outgoing; Fri, 17 Nov 1995 03:53:40 -0800 Received: from cls.net (freeside.cls.de [192.129.50.1]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id DAA27763 for ; Fri, 17 Nov 1995 03:53:31 -0800 Received: by mail.cls.net (Smail3.1.29.1) from allegro.lemis.de (192.109.197.134) with smtp id ; Fri, 17 Nov 95 11:52 GMT From: grog@lemis.de (Greg Lehey) Organisation: LEMIS, Schellnhausen 2, 36325 Feldatal, Germany Phone: +49-6637-919123 Fax: +49-6637-919122 Reply-To: grog@lemis.de (Greg Lehey) Received: (grog@localhost) by allegro.lemis.de (8.6.9/8.6.9) id MAA25180 for hackers@freebsd.org; Fri, 17 Nov 1995 12:50:51 +0100 Message-Id: <199511171150.MAA25180@allegro.lemis.de> Subject: mountd(8) performs illegal free() To: hackers@freebsd.org (FreeBSD Hackers) Date: Fri, 17 Nov 1995 12:50:50 +0100 (MET) X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 951 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: --- 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