fix generate password function
This commit is contained in:
parent
05cb50acb4
commit
9b0a781f05
@ -19,11 +19,11 @@ void generate_password(char* password)
|
|||||||
{
|
{
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
char characters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_-+={[}]|:;<,>.?";
|
char characters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_-+={[}]|:;<,>.?";
|
||||||
for (int i = 0; i < 15; i++)
|
for (int i = 0; i < MAX_STRING_SIZE; i++)
|
||||||
{
|
{
|
||||||
password[i] = characters[rand() % (sizeof(characters) - 1)];
|
password[i] = characters[rand() % (sizeof(characters) - 1)];
|
||||||
}
|
}
|
||||||
password[15] = '\0';
|
password[MAX_STRING_SIZE - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save_buffer_to_file(Buffer* buffer)
|
bool save_buffer_to_file(Buffer* buffer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user