Skip to contentSkip to conversation

Bug in more

parisc-linux Richard Hirst 1 participant 1 message Jan 11, 2001

lore
Share & tools
lore
#0 lore raw

Hi,
I have found a bug in 'more', util-linux-2.10r source.
At startup tailequ() is called to match the last component of argv[0] against "page". tailequ() is broken because it accesses one location below the start of argv[0]. This causes a crash on parisc, where the stack grows upwards and argv[0] is the first element on the stack.

Richard

text-utils/more.c renamed from text-utils/more.c- +2 -2
@@ -815,8 +815,8 @@
 	register char *tail;
 
 	tail = path + strlen(path);
-	while (tail >= path)
-		if (*(--tail) == '/')
+	while (--tail >= path)
+		if (*tail == '/')
 			break;
 	++tail;
 	while (*tail++ == *string++)