This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


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