Skip to content

Commit

Permalink
core/utils: use unsigned values in uwsgi_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed Dec 26, 2023
1 parent 42c9521 commit bf04a1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -4097,7 +4097,7 @@ void uwsgi_uuid(char *buf) {
uuid_generate(uuid_value);
uuid_unparse(uuid_value, buf);
#else
int i, r[11];
unsigned int i, r[11];
if (!uwsgi_file_exists("/dev/urandom"))
goto fallback;
int fd = open("/dev/urandom", O_RDONLY);
Expand All @@ -4113,7 +4113,7 @@ void uwsgi_uuid(char *buf) {
goto done;
fallback:
for (i = 0; i < 11; i++) {
r[i] = rand();
r[i] = (unsigned int) rand();
}
done:
snprintf(buf, 37, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10]);
Expand Down

0 comments on commit bf04a1e

Please sign in to comment.