Blame SOURCES/pinfo-0.6.9-mansection.patch

096b71
--- pinfo-0.6.9/src/manual.c.mansection	2006-03-16 15:14:30.000000000 +0100
096b71
+++ pinfo-0.6.9/src/manual.c	2007-02-23 14:52:30.000000000 +0100
096b71
@@ -167,16 +167,29 @@
096b71
 	}
096b71
 	i = len;
096b71
 	/* find the beginning of the last token */
096b71
-	for (i = len - 1;(i > 0) &&(!isspace(name1[i])); i--);
096b71
-
096b71
-	/* if we've found space, then we move to the first nonspace character */
096b71
-	if (i > 0)
096b71
-		i++;
096b71
+	for (i = len - 1;(i >= 0) &&(!isspace(name1[i])); i--)
096b71
+		;
096b71
+	i++;
096b71
 
096b71
 	/* filename->name */
096b71
-	strcpy(manualhistory[0].name, &name1[i]);
096b71
+	snprintf(manualhistory[0].name, 256, "%s", &name1[i]);
096b71
+
096b71
 	/* section unknown */
096b71
-	strcpy(manualhistory[0].sect, "");
096b71
+	manualhistory[0].sect[0] = 0;
096b71
+
096b71
+	/* try to find section */
096b71
+	if (i > 1) {
096b71
+		for (i--; (i >= 0) && isspace(name1[i]); i--)
096b71
+			;
096b71
+		if (i >= 0) {
096b71
+			name1[i + 1] = 0;
096b71
+			for (; (i >= 0) && !isspace(name1[i]); i--)
096b71
+				;
096b71
+			i++;
096b71
+			snprintf(manualhistory[0].sect, 32, "%s", &name1[i]);
096b71
+		}
096b71
+	}
096b71
+
096b71
 	/* selected unknown */
096b71
 	manualhistory[0].selected = -1;
096b71
 	/* pos=0 */