Fix segfault when generating password
This commit is contained in:
parent
7b7e48f985
commit
12bf43022a
1 changed files with 3 additions and 1 deletions
4
apm.c
4
apm.c
|
@ -166,7 +166,9 @@ void encrypt_password(const char *name, char *password)
|
|||
|
||||
size_t pw_len = strlen(password);
|
||||
/* find last \n and replace with 0 */
|
||||
strrchr(password, '\n')[0] = '\0';
|
||||
if (strrchr(password, '\n') != NULL) {
|
||||
strrchr(password, '\n')[0] = '\0';
|
||||
}
|
||||
char data[1024]; /* max 1024 bytes */
|
||||
strcpy(data, password);
|
||||
|
||||
|
|
Loading…
Reference in a new issue