[PATCH] NetBSD ELF core note type pretty-printing for readelf

Alan Modra amodra@bigpond.net.au
Wed Jan 9 08:51:00 GMT 2002


On Wed, Jan 09, 2002 at 11:44:11AM +0000, Nick Clifton wrote:
> 
> > +   else if (strncmp (pnote->namedata, "NetBSD-CORE", 11) == 0)
> 
> Why use strncmp() rather than strcmp().  [This is ignorance on my
> part, I do not know very much about the format of the contents of core
> files.]

In this case, it's an ELF NOTE, so it ought to be NULL terminated
according to the ELF standard, but maybe objects exist without the
NULL or with extra chars, eg. NetBSD-CORE1.  Hmm, I suppose the safest
code would first check pnote->namesz >= 11.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list