File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ main(int argc, char *argv[])
7575
7676 /* Do 16 passes. */
7777 for (ntests = 0 ; ntests < 16 ; ntests ++ ) {
78+ uint16_t time_hi_and_version ;
7879 unsigned char uuid_buf [16 ];
7980 char uuid_str [37 ];
8081
@@ -93,8 +94,9 @@ main(int argc, char *argv[])
9394 }
9495
9596 /* Version: bits 12-15 are 0010. */
96- if ((uuid .id .time_hi_and_version & 0xf000 ) != 0x4000 ) {
97- sudo_warnx ("bad version: 0x%x" , uuid .id .time_hi_and_version & 0xf000 );
97+ time_hi_and_version = ntohs (uuid .id .time_hi_and_version );
98+ if ((time_hi_and_version & 0xf000 ) != 0x4000 ) {
99+ sudo_warnx ("bad version: 0x%x" , (unsigned int )time_hi_and_version );
98100 errors ++ ;
99101 continue ;
100102 }
Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ sudo_uuid_create_v1(unsigned char uuid_out[restrict static 16])
5959 uuid .clock_seq_hi_and_reserved &= 0x3f ;
6060 uuid .clock_seq_hi_and_reserved |= 0x80 ;
6161
62+ /* Convert 16 and 32-bit fields to network byte order. */
63+ uuid .time_low = ntohl (uuid .time_low );
64+ uuid .time_mid = ntohs (uuid .time_mid );
65+ uuid .time_hi_and_version = ntohs (uuid .time_hi_and_version );
66+
6267 memcpy (uuid_out , & uuid , 16 );
6368}
6469
You can’t perform that action at this time.
0 commit comments