Article View: net.bugs.4bsd
Article #1691bug in BSD cb(1)
From: chris
Date: Wed, 01 Oct 1986 21:45
Date: Wed, 01 Oct 1986 21:45
41 lines
1261 bytes
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
Technical Details
Message-ID:
<34@pixutl.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!elbereth!rutgers!husc6!wjh12!pixel!pixutl!chrisShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!elbereth!rutgers!husc6!wjh12!pixel!pixutl!chris From: chris@pixutl.UUCP (chris) Newsgroups: net.bugs.4bsd Subject: bug in BSD cb(1) Message-ID: <34@pixutl.UUCP> Date: Wed, 1-Oct-86 17:45:13 EDT Article-I.D.: pixutl.34 Posted: Wed Oct 1 17:45:13 1986 Date-Received: Sat, 4-Oct-86 05:39:15 EDT Organization: xePIX Inc., Nashua, N.H. Lines: 41 Keywords: cb, comment