From 1ec80ffd3617b803673a7846ad927c777ca2c2fa Mon Sep 17 00:00:00 2001 From: millert Date: Sun, 2 Apr 2000 21:04:37 +0000 Subject: [PATCH] arc4random() returns an unsigned 32-bit int but sendmail expects the RNG to return a signed (but positive) value. This resulted in some random numbers being interpreted as signed negative. In one case the result was being used to traverse an array so bad things (tm) were happening. The fix is to simply mask out the sign bit. --- gnu/usr.sbin/sendmail/sendmail/conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.h b/gnu/usr.sbin/sendmail/sendmail/conf.h index f2a83c36de8..9de4ecf8e20 100644 --- a/gnu/usr.sbin/sendmail/sendmail/conf.h +++ b/gnu/usr.sbin/sendmail/sendmail/conf.h @@ -2678,7 +2678,7 @@ typedef void (*sigfunc_t) __P((int)); /* random routine -- set above using #ifdef _osname_ or in Makefile */ #if HASARC4RANDOM -# define get_random() arc4random() +# define get_random() (arc4random() & 0x7fffffff) #else # if HASRANDOM # define get_random() random() -- 2.20.1