minor bug in strings

Jeff Gilliam jeff at voder.UUCP
Fri Oct 19 09:49:55 AEST 1984


Subject: minor bug in strings
Index: 	ucb/strings.c 4.[12]BSD	Fix

Description:
	Strings has a minor bug which causes it to ignore the first 32
	bytes of the data segment when run on and executable file and
	*not* given the '-' flag.

Repeat-By:
	Try 'strings /usr/ucb/strings'.  You'll see output beginning
	with:

	>>>	eley) 3/30/83
		Usage: strings [ -a ] [ -o ] [ -# ] [ file ... ]
		%7D 
		.
		.
		.

	Pretty clearly it is missing something at the very beginning.
Fix:
	The fix is trivial; an fseek incorrectly seeks from the current
	position when it *should* seek from the beginning of the file.
	Contextual diffs follow:

	RCS file: /usr/src/ucb/RCS/strings.c,v
	retrieving revision 1.1
	retrieving revision 1.2
	diff -c -r1.1 -r1.2
	*** /tmp/,RCSt1023819	Thu Oct 11 21:59:20 1984
	--- /tmp/,RCSt2023819	Thu Oct 11 21:59:21 1984
	***************
	*** 67,73
				find((long) 100000000L);
				continue;
			}
	! 		fseek(stdin, (long) N_TXTOFF(header)+header.a_text, 1);
			find((long) header.a_data);
		} while (argc > 0);
	  }

	--- 67,73 -----
				find((long) 100000000L);
				continue;
			}
	! 		fseek(stdin, (long) N_TXTOFF(header)+header.a_text, 0);
			find((long) header.a_data);
		} while (argc > 0);
	  }


-- 

Jeff Gilliam	{ucbvax,ihnp4!nsc}!voder!jeff



More information about the Comp.bugs.4bsd.ucb-fixes mailing list