🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by chris Wed, 01 Oct 1986 21:45
bug in BSD cb(1)
#1691
Author: chris
Date: Wed, 01 Oct 1986 21:45
41 lines
1261 bytes
cb(1) doesn't check for EOF while handling comments and core dumps if comment
is non-terminated (some might say 'too bad', but...)

---------------------
REPEAT BY:

	% cat > /tmp/x
	/*
	^D
	% cb < /tmp/x

---------------------
FIX:		add the EOF test to the comment routine.

comment(){
rep:
	while((c = string[j++] = getch()) != '*')
		if(c == '\n'){
			puts();
			sflg = 1;
		}
		else if(c == EOF) {
			fprintf(stderr, "error: EOF in comment\n");
			exit(1);
		}
gotstar:
	if((c = string[j++] = getch()) != '/'){
		if(c == '*')goto gotstar;
		goto rep;
	}
}



-- 

 Chris Bertin       :  (603) 881-8791 x218
 xePIX Inc.         :
 51 Lake St         :  {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\
 Nashua, NH 03060   :     !wjh12!pixel!pixutl!chris
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads