mirror of
https://github.com/rfc1036/whois.git
synced 2026-05-03 06:51:09 +00:00
mkpasswd: prevent using two unitialized variables
This commit is contained in:
parent
f01f8d405b
commit
114b9d2fd9
@ -273,6 +273,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!salt_prefix) {
|
if (!salt_prefix) {
|
||||||
/* NULL means that crypt_gensalt will choose one later */
|
/* NULL means that crypt_gensalt will choose one later */
|
||||||
|
rounds_str[0] = '\0';
|
||||||
} else if (rounds_support == 2) {
|
} else if (rounds_support == 2) {
|
||||||
/* bcrypt strings always contain the rounds number */
|
/* bcrypt strings always contain the rounds number */
|
||||||
if (rounds <= 5)
|
if (rounds <= 5)
|
||||||
@ -325,6 +326,8 @@ int main(int argc, char *argv[])
|
|||||||
* Build the actual argument to crypt(3) by concatenating the
|
* Build the actual argument to crypt(3) by concatenating the
|
||||||
* method prefix, the rounds metadata (if any) and the salt string.
|
* method prefix, the rounds metadata (if any) and the salt string.
|
||||||
*/
|
*/
|
||||||
|
if (!salt_prefix)
|
||||||
|
salt_prefix = "";
|
||||||
salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str)
|
salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str)
|
||||||
+ strlen(salt_arg) + 1));
|
+ strlen(salt_arg) + 1));
|
||||||
*salt = '\0';
|
*salt = '\0';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user