diff --git a/Password_manager/source/func.cpp b/Password_manager/source/func.cpp index 27e7fe3..cab91ec 100644 --- a/Password_manager/source/func.cpp +++ b/Password_manager/source/func.cpp @@ -19,11 +19,11 @@ void generate_password(char* password) { srand(time(NULL)); 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[15] = '\0'; + password[MAX_STRING_SIZE - 1] = '\0'; } bool save_buffer_to_file(Buffer* buffer)