Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > 753992651a542b0de468c3b2584455bd > files > 5

file-5.04-7.fc13.src.rpm

--- 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++)