0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 21:28:53 +02:00

extensions/mkpasswd: Do not leak /dev/random fd.

This commit is contained in:
Jilles Tjoelker 2014-02-23 22:18:44 +01:00
parent 899b05d387
commit f9960c0262

View file

@ -210,6 +210,7 @@ generate_random_salt(char *salt, int length)
if(read(fd, buf, length) != length)
{
free(buf);
close(fd);
return (generate_poor_salt(salt, length));
}
@ -218,5 +219,6 @@ generate_random_salt(char *salt, int length)
salt[i] = saltChars[abs(buf[i]) % 64];
}
free(buf);
close(fd);
return (salt);
}