]> granicus.if.org Git - file/commitdiff
Try more offsets for Debian core files.
authorChristos Zoulas <christos@zoulas.com>
Thu, 22 Apr 2010 16:54:17 +0000 (16:54 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 22 Apr 2010 16:54:17 +0000 (16:54 +0000)
Arnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>

src/readelf.c

index 0e8b9a6ba21a913463490317bc8d55351dcb0198..ca302b17f9a3cbe53a6a894501fdf49ab4cfe865 100644 (file)
@@ -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++)