[comp.bugs.4bsd] RCS dereferneces a null pointer. +Fix

gww@marduk.UUCP (Gary Winiger) (09/05/87)

Subject: RCS dereferneces a null pointer. +Fix
Index:	new/rcs 4.3BSD +Fix

Description:
	Rcs can dereference a null pointer.
Repeat-By:
	I don't recall the circumstances.  This bug was resolved some time
	ago and was not posted.  In porting 4.3 it was corrected again.
Fix:
	The attached code fixes this problem at Elxsi.

Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww
--------- cut --------- snip --------- :.,$w diff -------------
*** /tmp/,RCSt1007134	Wed Dec 10 16:02:06 1986
--- rcs.c	Wed Dec 10 14:10:54 1986
***************
*** 1,10 ****
  /*
   * $Log:	rcs.c,v $
   * Revision 1.1  86/12/09  17:33:55  gww
   * Initial revision
   * 
   */
! static char *ERcsId = "$Header: rcs.c,v 1.1 86/12/09 17:33:55 gww Exp $ ENIX BSD";
  /*
   *                      RCS create/change operation
   */
--- 1,13 ----
  /*
   * $Log:	rcs.c,v $
+  * Revision 1.2  86/12/10  14:10:35  gww
+  * Get rid of NULL pointer.
+  * 
   * Revision 1.1  86/12/09  17:33:55  gww
   * Initial revision
   * 
   */
! static char *ERcsId = "$Header: rcs.c,v 1.2 86/12/10 14:10:35 gww Exp $ ENIX BSD";
  /*
   *                      RCS create/change operation
   */
***************
*** 994,1000 ****
          dummy.nextlock=next=Locks;
          trail = &dummy;
          while (next!=nil) {
!                numr = strcmp(num, next->delta->num);
                 if ((whor=strcmp(who,next->login))==0 &&
                    (num==nil || numr==0))
                          break; /* found a lock */
--- 997,1003 ----
          dummy.nextlock=next=Locks;
          trail = &dummy;
          while (next!=nil) {
!                numr = (num==nil)?-1:strcmp(num, next->delta->num);
                 if ((whor=strcmp(who,next->login))==0 &&
                    (num==nil || numr==0))
                          break; /* found a lock */