[PATCH xdm] Missed on arc4random() conversion.
Alan Coopersmith
alan.coopersmith at oracle.com
Wed Jan 6 21:49:41 PST 2016
On 01/ 5/16 11:14 PM, Matthieu Herrb wrote:
> On Tue, Jan 05, 2016 at 02:49:44PM -0800, Alan Coopersmith wrote:
>> On 01/ 5/16 12:34 PM, Matthieu Herrb wrote:
>>> Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
>>> ---
>>> xdm/genauth.c | 9 +++++++--
>>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git xdm/genauth.c xdm/genauth.c
>>> index 5db7315..f50be3b 100644
>>> --- xdm/genauth.c
>>> +++ xdm/genauth.c
>>> @@ -408,15 +408,20 @@ GenerateAuthData (char *auth, int len)
>>> static int xdmcpAuthInited;
>>> long ldata[2];
>>>
>>> -# ifdef ITIMER_REAL
>>> +# ifndef HAVE_ARC4RANDOM
>>> +# ifdef ITIMER_REAL
>>> struct timeval now;
>>>
>>> X_GETTIMEOFDAY (&now);
>>> ldata[0] = now.tv_usec;
>>> ldata[1] = now.tv_sec;
>>> -# else
>>> +# else
>>> ldata[0] = time ((long *) 0);
>>> ldata[1] = getpid ();
>>> +# endif
>>> +# else
>>> + ldata[0] = arc4random();
>>> + ldata[1] = arc4random();
>>> # endif
>>>
>>> longtochars (ldata[0], data+0);
>>>
>>
>> Does it matter that arc4random is only providing 32-bits of data into
>> a long?
>
> Hmm good question. Since those 2 values are then poured
> into a char[8] array by longtochar(), it shouldn't matter.
> longtochars seems to to be effectively only using the 32 low bits of
> its long parameter.
Okay - it would probably be clearer long term to use a uint32_t or CARD32
instead of a long, but this works for now, so:
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
More information about the xorg-devel
mailing list