[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] util: Fix virUUIDGeneratePseudoRandomBytes



On Sat, Oct 29, 2011 at 12:06 AM, Eric Blake <eblake redhat com> wrote:
> On 10/28/2011 05:06 AM, Ryota Ozaki wrote:
>>
>> It forgets to move a pointer to a buffer for UUID and as a result
>> fills only the first byte of the buffer.
>> ---
>>  src/util/uuid.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> How embarrassing!  That bug has been present since commit bce1d26, Feb 2007!
>  The only reason we haven't noticed it is that most systems have a good
> /dev/urandom.

Oh...actually I had never executed the function and found the bug by chance :-)

  ozaki-r

>
> ACK and pushed.
>
>>
>> diff --git a/src/util/uuid.c b/src/util/uuid.c
>> index 0df3ebc..823a2b9 100644
>> --- a/src/util/uuid.c
>> +++ b/src/util/uuid.c
>> @@ -80,7 +80,7 @@ virUUIDGeneratePseudoRandomBytes(unsigned char *buf,
>>                                   int buflen)
>>  {
>>      while (buflen>  0) {
>> -        *buf = virRandom(256);
>> +        *buf++ = virRandom(256);
>>          buflen--;
>>      }
>>
>
> --
> Eric Blake   eblake redhat com    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]