Open furkanonder opened 19 hours ago
In NetBSD the py_uuid_generate_time_safe function generates a uuid using the uuid_create
and uuid_enc_be
functions. The uuid version generated is 4.
An example to reproduce the situation;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uuid.h>
int main() {
uuid_t *uuid;
unsigned char encoded_uuid[16];
uuid = malloc(sizeof(struct uuid));
if (!uuid) {
fprintf(stderr, "Memory allocation failed\n");
return 1;
}
uuid_create(uuid, NULL);
uuid_enc_be(encoded_uuid, uuid);
printf("Converted UUID: ");
for (int i = 0; i < 16; i++) {
printf("%02x", encoded_uuid[i]);
if ((i == 3 || i == 5 || i == 7 || i == 9) && i < 15) {
printf("-");
}
}
printf("\n");
free(uuid);
return 0;
}
home$ gcc uuid_example.c -o uuid_example
home$ ./uuid_example
Converted UUID: 18bea948-0a56-4b61-9973-10ce1a098203
home$ ./uuid_example
Converted UUID: 1b2f696c-942e-490d-bfa6-d49246de6ad2
home$ ./uuid_example
Converted UUID: f9aa5345-9ac2-4528-8817-bf5b8a60ba4d
Bug report
Bug description:
CPython versions tested on:
CPython main branch
Operating systems tested on:
Other
Linked PRs