Changeset 0f6a85ae in mainline


Ignore:
Timestamp:
2019-02-15T13:34:23Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
43dd2d4b
Parents:
9f4ce50
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-15 13:28:51)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-15 13:34:23)
Message:

Fix version 4 UUID generation

According to the standard, the 4 most significant bits of b[6]
are to be 0x4. Our code accidentally cleared the wrong portion
of the byte.
Also the most significant bit of b[8] should be 1 and the second
most significant should be 0. Our code had them swapped.

Found by Matthieu Riolo, thanks!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/uuid.c

    r9f4ce50 r0f6a85ae  
    6464
    6565        /* Version 4 UUID from random or pseudo-random numbers */
    66         uuid->b[8] = (uuid->b[8] & ~0xc0) | 0x40;
    67         uuid->b[6] = (uuid->b[6] & 0xf0) | 0x40;
     66        uuid->b[6] = (uuid->b[6] & 0x0f) | 0x40;
     67        uuid->b[8] = (uuid->b[8] & 0x3f) | 0x80;
    6868
    6969        return EOK;
Note: See TracChangeset for help on using the changeset viewer.