mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 08:21:09 +01:00
extensions/mkpasswd: Do not leak /dev/random fd.
This commit is contained in:
parent
899b05d387
commit
f9960c0262
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue