diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-01-01 00:33:14 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-01-01 00:33:14 +0100 |
commit | dedb333b8002fb4d5a1420aa12c2389c83553888 (patch) | |
tree | feb357c1988aa58fbefdb85dbb87abc17537b2ff /FICS | |
parent | 66676d7e83f25db394bd1709c37a279ae3a0e511 (diff) |
Replaced strcpy() call with strlcpy()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/fics_addplayer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/FICS/fics_addplayer.c b/FICS/fics_addplayer.c index 16d2631..1eed6f1 100644 --- a/FICS/fics_addplayer.c +++ b/FICS/fics_addplayer.c @@ -28,11 +28,18 @@ #include "stdinclude.h" #include "common.h" +#include <err.h> +#include <string.h> + #include "command.h" #include "fics_getsalt.h" #include "playerdb.h" #include "utils.h" +#if __linux__ +#include <bsd/string.h> +#endif + #define PASSLEN 8 PRIVATE char *funame = NULL; @@ -116,7 +123,9 @@ main(int argc, char *argv[]) password[i] = ('a' + arc4random_uniform(26)); password[i] = '\0'; - strcpy(salt, fics_getsalt()); + if (strlcpy(salt, fics_getsalt(), sizeof salt) >= sizeof salt) + errx(1, "salt truncated"); + parray[p].passwd = xstrdup(crypt(password, salt)); parray[p].registered = 1; // parray[p].network_player = !local; |