file/file-5.04-core-trim.patch

29 lines
769 B
Diff
Raw Normal View History

--- file-4.26.OLD/src/readelf.c 2008-07-26 17:03:55.000000000 +0200
+++ file-4.26/src/readelf.c 2008-12-03 17:16:57.000000000 +0100
@@ -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++)