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)
|
if(read(fd, buf, length) != length)
|
||||||
{
|
{
|
||||||
free(buf);
|
free(buf);
|
||||||
|
close(fd);
|
||||||
return (generate_poor_salt(salt, length));
|
return (generate_poor_salt(salt, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,5 +219,6 @@ generate_random_salt(char *salt, int length)
|
||||||
salt[i] = saltChars[abs(buf[i]) % 64];
|
salt[i] = saltChars[abs(buf[i]) % 64];
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
|
close(fd);
|
||||||
return (salt);
|
return (salt);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue