urandom_alphanumeric: Better distribution when using random()

This commit is contained in:
Heikki Hannikainen 2017-04-15 11:59:23 +03:00
parent c1385db760
commit 448c71fbbd
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ int urandom_alphanumeric(int fd, unsigned char *buf, int buflen)
/* urandom failed for us, use something inferior */
for (l = 0; l < len; l++) {
// coverity[dont_call] // squelch warning: not security sensitive use of random()
buf[l] = random() % 256;
buf[l] = random() % (26+10);
}
}