This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH, RFA] Fix basename bug in symtab.c


> [Jim, Elena, sorry I keep saying cygnus instead of redhat :-(]
> 
> Here is a patch that fixes the problems discussed on the discussion
> list.  Eli pretty much convinced me that this is the right approach.
> We can still discuss the other uses of basename() in GDB, but since
> this fixes a rather serious bug on FreeBSD (and I suppose other
> systems as well), I'd like to get this in ASAP.


Just to be clear on one thing, the bug occures on FreeBSD.  It isn't a 
FreeBSD bug :-).  To quote the opengroup standard:

> #include <libgen.h>
> char *basename(char *path);

...

> The basename() function may modify the string pointed to by path, and may return a pointer to static storage that may then be overwritten by a subsequent call to basename().
> 
> This interface need not be reentrant.


Any way, looking at libiberty/lbasename.c, it casts:

	(const char*) -> (char *)

so I'd not call that function safe either (actually grrrr).

	Andrew



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]