Thread View: net.bugs
2 messages
2 total messages
Started by Ray Chen
Fri, 30 Nov 1984 07:30
rcs bug: ci handles -[nN]name improperly
Author: Ray Chen
Date: Fri, 30 Nov 1984 07:30
Date: Fri, 30 Nov 1984 07:30
131 lines
5553 bytes
5553 bytes
File: (whatever)/rcs/src/rcs/ci.c
Description: ci allows names following -[nN] to have name delimiter
characters such as white space in them. This results in
later operations on the file producing errors.
Repeat-by: ci -n"test 1" file
ci -Ntest2 file
Fix: The problem results from the fact the routine checkid()
checks a symbol for validity but stops on symbol delimiting
characters, the set of which which includes characters other
than \0. ci, however, assumes that the entire name string
is a valid symbol if no error occurs, so it installs the
entire string as the name. This results in a situation where a
name could be installed consisting of one valid symbol and an
arbitrary number of possibly invalid symbols. The fix is simply
to make ci use the information that checkid() returns -- a
pointer to the character it stopped on, and to exit with a
fatal error (and error message) if the delimiting character was
a non-NULL one.
Ray Chen
princeton!tilt!chenr
----------Diffs follow-------------------------------
RCS file: RCS/ci.c,v
retrieving revision 3.9
retrieving revision 3.10
diff -c -r3.9 -r3.10
*** /tmp/,RCSt1011713 Fri Nov 30 01:54:16 1984
--- /tmp/,RCSt2011713 Fri Nov 30 01:54:24 1984
***************
*** 2,8
* RCS checkin operation
*/
static char rcsid[]=
! "$Header: ci.c,v 3.9 83/02/15 15:25:44 wft Exp $ Purdue CS";
/*******************************************************************
* check revisions into RCS files
*******************************************************************
--- 2,8 -----
* RCS checkin operation
*/
static char rcsid[]=
! "$Header: ci.c,v 3.10 84/11/30 01:23:01 chenr Exp $ Purdue CS";
/*******************************************************************
* check revisions into RCS files
*******************************************************************
***************
*** 21,26
/* $Log: ci.c,v $
* Revision 3.9 83/02/15 15:25:44 wft
* original ci.c
*
--- 21,32 -----
/* $Log: ci.c,v $
+ * Revision 3.10 84/11/30 01:23:01 chenr
+ * Added char *nametest to force name in -[nN]name to be a one word
+ * symbol. If this isn't the case, then ci aborts with a fatal error.
+ * A quick and dirty fix to prevent names from being placed into the
+ * delta files that won't be properly handled later.
+ *
* Revision 3.9 83/02/15 15:25:44 wft
* original ci.c
*
***************
*** 126,131
{
register int i;
register char * sp, *tp;
char * cmdusage; /* holds command format */
char command[NCPPN+50]; /* holds diff commands */
char curdate[datelength];/* date for new delta */
--- 132,138 -----
{
register int i;
register char * sp, *tp;
+ char *nametest;
char * cmdusage; /* holds command format */
char command[NCPPN+50]; /* holds diff commands */
char curdate[datelength];/* date for new delta */
***************
*** 197,203
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! checkid(symbol,' ');
} else warn("Missing name for -n option");
break;
--- 204,212 -----
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! if ((nametest = checkid(symbol,' ')) != NULL)
! faterror("Name %s must be one word",
! symbol);
} else warn("Missing name for -n option");
break;
***************
*** 206,212
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! checkid(symbol,' ');
} else warn("Missing name for -N option");
break;
--- 215,223 -----
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! if ((nametest = checkid(symbol,' ')) != NULL)
! faterror("Name %s must be one word",
! symbol);
} else warn("Missing name for -N option");
break;
Re: rcs bug: An update
Author: Ray Chen
Date: Sun, 02 Dec 1984 02:44
Date: Sun, 02 Dec 1984 02:44
139 lines
5857 bytes
5857 bytes
A correction to a 3:00 AM mistake. The idea was right but the code
wasn't. Updated diffs follow.
File: (whatever)/rcs/src/rcs/ci.c
Description: ci allows names following -[nN] to have name delimiter
characters such as white space in them. This results in
later operations on the file producing errors.
Repeat-by: ci -n"test 1" file
ci -Ntest2 file
Fix: The problem results from the fact the routine checkid()
checks a symbol for validity but stops on symbol delimiting
characters, the set of which which includes characters other
than \0. ci, however, assumes that the entire name string
is a valid symbol if no error occurs, so it installs the
entire string as the name. This results in a situation where a
name could be installed consisting of one valid symbol and an
arbitrary number of possibly invalid symbols. The fix is simply
to make ci use the information that checkid() returns -- a
pointer to the character it stopped on, and to exit with a
fatal error (and error message) if the delimiting character was
a non-NULL one.
Ray Chen
princeton!tilt!chenr
RCS file: RCS/ci.c,v
retrieving revision 3.11
retrieving revision 3.9
diff -c -r3.11 -r3.9
*** /tmp/,RCSt1001960 Sat Dec 1 21:39:33 1984
--- /tmp/,RCSt2001960 Sat Dec 1 21:39:42 1984
***************
*** 2,8
* RCS checkin operation
*/
static char rcsid[]=
! "$Header: ci.c,v 3.11 84/12/01 21:31:17 chenr Exp $ Purdue CS";
/*******************************************************************
* check revisions into RCS files
*******************************************************************
--- 2,8 -----
* RCS checkin operation
*/
static char rcsid[]=
! "$Header: ci.c,v 3.9 83/02/15 15:25:44 wft Exp $ Purdue CS";
/*******************************************************************
* check revisions into RCS files
*******************************************************************
***************
*** 21,36
/* $Log: ci.c,v $
- * Revision 3.11 84/12/01 21:31:17 chenr
- * Changed checkid() test in -[nN] handling section to test the character
- * pointed to by the pointer and not the pointer itself.
- *
- * Revision 3.10 84/11/30 01:23:01 chenr
- * Added char *nametest to force name in -[nN]name to be a one word
- * symbol. If this isn't the case, then ci aborts with a fatal error.
- * A quick and dirty fix to prevent names from being placed into the
- * delta files that won't be properly handled later.
- *
* Revision 3.9 83/02/15 15:25:44 wft
* original ci.c
*
--- 21,26 -----
/* $Log: ci.c,v $
* Revision 3.9 83/02/15 15:25:44 wft
* original ci.c
*
***************
*** 136,142
{
register int i;
register char * sp, *tp;
- char *nametest;
char * cmdusage; /* holds command format */
char command[NCPPN+50]; /* holds diff commands */
char curdate[datelength];/* date for new delta */
--- 126,131 -----
{
register int i;
register char * sp, *tp;
char * cmdusage; /* holds command format */
char command[NCPPN+50]; /* holds diff commands */
char curdate[datelength];/* date for new delta */
***************
*** 208,217
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! nametest = checkid(symbol,' ');
! if (*nametest != NULL)
! faterror("Name %s must be one word",
! symbol);
} else warn("Missing name for -n option");
break;
--- 197,203 -----
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! checkid(symbol,' ');
} else warn("Missing name for -n option");
break;
***************
*** 220,229
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! nametest = checkid(symbol,' ');
! if (*nametest != NULL)
! faterror("Name %s must be one word",
! symbol);
} else warn("Missing name for -N option");
break;
--- 206,212 -----
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! checkid(symbol,' ');
} else warn("Missing name for -N option");
break;
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