From: Christos Zoulas Date: Thu, 22 Apr 2010 16:54:17 +0000 (+0000) Subject: Try more offsets for Debian core files. X-Git-Tag: FILE5_07~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d26328533a650c4cee91e486caf1ba5d93003965;p=file Try more offsets for Debian core files. Arnaud Giersch --- diff --git a/src/readelf.c b/src/readelf.c index 0e8b9a6b..ca302b17 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: readelf.c,v 1.82 2009/05/08 17:41:59 christos Exp $") +FILE_RCSID("@(#)$File: readelf.c,v 1.83 2009/05/13 14:43:10 christos Exp $") #endif #ifdef BUILTIN_ELF @@ -738,6 +738,25 @@ core: /* * Well, that worked. */ + + /* + * Try next offsets, in case this match is + * in the middle of a string. + */ + size_t k; + for (k = i + 1 ; k < NOFFSETS ; k++) { + if (prpsoffsets(k) >= prpsoffsets(i)) + continue; + size_t no; + int adjust = 1; + for (no = doff + prpsoffsets(k); + no < doff + prpsoffsets(i); no++) + adjust = adjust + && isprint(nbuf[no]); + if (adjust) + i = k; + } + cname = (unsigned char *) &nbuf[doff + prpsoffsets(i)]; for (cp = cname; *cp && isprint(*cp); cp++)