From owner-freebsd-bugs Wed Jan 29 01:30:03 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id BAA21498 for bugs-outgoing; Wed, 29 Jan 1997 01:30:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id BAA21492; Wed, 29 Jan 1997 01:30:02 -0800 (PST) Date: Wed, 29 Jan 1997 01:30:02 -0800 (PST) Message-Id: <199701290930.BAA21492@freefall.freebsd.org> To: freebsd-bugs Cc: From: j@uriah.heep.sax.de (J Wunsch) Subject: Re: gnu/2610: strdup will cause you app to core if passed a NULL string Reply-To: j@uriah.heep.sax.de (J Wunsch) Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR gnu/2610; it has been noted by GNATS. From: j@uriah.heep.sax.de (J Wunsch) To: Thomas.Traylor@mci.com Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: gnu/2610: strdup will cause you app to core if passed a NULL string Date: Wed, 29 Jan 1997 10:05:36 +0100 As Thomas S Traylor wrote: > >Number: 2610 > >Category: gnu Well, `gnu' is the wrong category, but nevermind. > The library function strdup does not handle a NULL string being > passed to it. When you do the application cores. Then don't do it. It's not supposed to `duplicate' a NULL pointer, i think. What would you exect from it? Another NULL pointer? How do you distinguish it from ``Out of memory''? Neither of the strxxx() functions accept NULL pointers, so i won't see a reason for strdup(). -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)