4.3-tahoe random(3) bug

Arnold D. Robbins {EUCC} arnold at mathcs.emory.edu
Sat Nov 11 03:27:20 AEST 1989


Subject: Bug in initstate in random.c
Index:	libc/random.c 4.3BSD-tahoe from UUNET a while back

Description:
	There is a bug pointed out by Scott Garfinkle in the random.c file.
	This was gotten from UUNET some months back, perhaps it has been fixed
	since then.

	In initstate, if there isn't enough room, it just returns, instead of
	explicitly returning a null pointer.
Repeat-By:
	Call initstate with not enough room.
Fix:
	Apply the following patch.

*** ../patch.0/missing.d/random.c	Thu Apr 13 08:01:19 1989
--- random.c	Fri Nov 10 10:28:46 1989
***************
*** 236,242 ****
  	if(  n  <  BREAK_1  )  {
  	    if(  n  <  BREAK_0  )  {
  		fprintf( stderr, "initstate: not enough state (%d bytes) with which to do jack; ignored.\n", n );
! 		return;
  	    }
  	    rand_type = TYPE_0;
  	    rand_deg = DEG_0;
--- 236,242 ----
  	if(  n  <  BREAK_1  )  {
  	    if(  n  <  BREAK_0  )  {
  		fprintf( stderr, "initstate: not enough state (%d bytes) with which to do jack; ignored.\n", n );
! 		return 0;
  	    }
  	    rand_type = TYPE_0;
  	    rand_deg = DEG_0;
-- 
Arnold Robbins -- Emory U. Information Technology Div.  | Laundry increases
DOMAIN: arnold at emoryu1.cc.emory.edu			| exponentially in the
UUCP: gatech!emoryu1!arnold  PHONE: +1 404 727-7636	| number of children.
BITNET: arnold at emoryu1	     FAX:   +1 404 727-2599	|   -- Miriam Hartholz



More information about the Comp.bugs.4bsd.ucb-fixes mailing list