🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs
Article #148

Yet another curses bug (net.sources and 4.2 dist.)

#148
From: Mike Laman
Date: Mon, 14 Nov 1983 01:41
46 lines
1676 bytes
    The following bug is in the curses library distributed over net.sources,
and in the 4.2 BSD distribution (that sdcsvax received at least).

    The bug is in makech() (in refresh.c).  makech() gets called to give
output for the given LINE (hint hint).  It is interesting that this bug
managed to get out.  Here is the offending code (the simple fix follows).

			:
			:
			:
		else if (wx < lch)
			while (*nsp == *csp) {
				nsp++;
				if (!curwin)
					csp++;
				++wx;
			}
		else
			:
			:
			:

I wrote a program that added '*' to (0, 0) on stdscr then a refresh().
wx ended up with a value of over 3000!  That loop walked down the line
and the next, ... (all the way down the window!).  The following code
is the fix.  Notice that the ++wx looks just perfect.  It really makes one
think "they" thought of it, but merely forgot to add the test.

			:
			:
			:
		else if (wx < lch)
			while (*nsp == *csp && wx <= lch) {
				nsp++;
				if (!curwin)
					csp++;
				++wx;
			}
		else
			:
			:
			:

			Mike Laman
			UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman
Technical Details
Message-ID: <3@sdcsvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!security!genrad!decvax!sdchema!sdcsvax!laman

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!security!genrad!decvax!sdchema!sdcsvax!laman
From: laman@sdcsvax.UUCP (Mike Laman)
Newsgroups: net.bugs,net.bugs.4bsd
Subject: Yet another curses bug (net.sources and 4.2 dist.)
Message-ID: <3@sdcsvax.UUCP>
Date: Sun, 13-Nov-83 20:41:53 EST
Article-I.D.: sdcsvax.3
Posted: Sun Nov 13 20:41:53 1983
Date-Received: Thu, 17-Nov-83 23:08:50 EST
Organization: U.C. San Diego, Computer Science Dept.
Lines: 45