[comp.sys.att] Bug in WINDY

jbm@uncle.UUCP (John B. Milton) (10/21/87)

I like to use windy to invoke vi so that when you get done editing you come
back to the old text that was on screen (the original window). I get to
vi with a ksh function:
function vi { windy vi $*; }
This worked fine as long as you only edit a few files. If you edit a large
number files, windy will core dump. Once I figured out that the core dump
was windy and not vi, I rompted right in there and fixed it! The author
forgot that sometimes the parameter buffer can get VERY LARGE and did not
dimension an array correctly. There are two arrays in the program. One deals
with the soft key labels and SHOULD be 80 characters. The other is the
parameter buffer. This should be NCARGS from sys/param.h. I peeked and found
it to be 5120.

Add:
#include <sys/param.h>

Change:
	char avname[81];
To:
	char avname[NCARGS+1];
	
Change:
			strncat(avname, av[i], 80);
			strncat(avname, " ", 80);
To:
			strncat(avname, av[i], NCARGS);
			strncat(avname, " ", NCARGS);

This brings up an interesting question: When one does a ktune, are the
correct .h files updated?


-- 
John Bly Milton IV	{ihnp4|cbosgd}!n8emr!uncle!jbm
(614)294-4823 		(home, where the ATT 7300 [uncle] lives)
(614)424-7677 		(work, where the  HP 9836 lives)