fep - bad use of longjmp/bad pointer comparison

Rob McMahon cudcv at warwick.ac.uk
Wed Dec 21 05:16:14 AEST 1988


Fep passes the wrong number of parameters to longjmp.  The value returned from
setjmp is not tested, so this will probably still work on most machines, but
it still seems like a bad move.

Also it uses (p <= 0) for `char *p', which will no doubt fail if `p' happens
to end up with its top bit set.
-- 
(Line numbers may vary)
RCS file: fep_edit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** /tmp/,RCSt1a03910	Tue Dec 20 19:10:41 1988
--- /tmp/,RCSt2a03910	Tue Dec 20 19:10:42 1988
***************
*** 1712,1718 ****
  		fputs ("\r\n", stdout);
  		perror ("alloca:");
  		reprint ();
! 		longjmp (jbuf);
  	    }
  	    strcpy (fcp, dp->d_name);
  	    fileList [i++] = fcp;
--- 1712,1718 ----
  		fputs ("\r\n", stdout);
  		perror ("alloca:");
  		reprint ();
! 		longjmp (jbuf, 1);
  	    }
  	    strcpy (fcp, dp->d_name);
  	    fileList [i++] = fcp;
***************
*** 1902,1908 ****
  		fputs ("\r\n", stdout);
  		perror ("alloca:");
  		reprint ();
! 		longjmp (jbuf);
  	    }
  	    strcpy (fcp, dp->d_name);
  	    fileList [i++] = fcp;
--- 1902,1908 ----
  		fputs ("\r\n", stdout);
  		perror ("alloca:");
  		reprint ();
! 		longjmp (jbuf, 1);
  	    }
  	    strcpy (fcp, dp->d_name);
  	    fileList [i++] = fcp;
-- 
RCS file: fep_main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1a03918	Tue Dec 20 19:12:05 1988
--- /tmp/,RCSt2a03918	Tue Dec 20 19:12:06 1988
***************
*** 243,249 ****
       * Initialize output buffer.
       */
      output_buffer->buf = (char *) malloc (5120);
!     if (output_buffer->buf <= 0) {
  	fprintf (stderr, "Can't allocate enough momory\n");
  	kill_process ();
  	exit (1);
--- 243,249 ----
       * Initialize output buffer.
       */
      output_buffer->buf = (char *) malloc (5120);
!     if (output_buffer->buf == 0) {
  	fprintf (stderr, "Can't allocate enough momory\n");
  	kill_process ();
  	exit (1);
-- 
Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv at uk.ac.warwick             ARPA:   cudcv at warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England



More information about the Comp.sources.bugs mailing list