summaryrefslogtreecommitdiffstats
path: root/usr.bin/enigma/enigma.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/enigma/enigma.c')
-rw-r--r--usr.bin/enigma/enigma.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/enigma/enigma.c b/usr.bin/enigma/enigma.c
index 49cb006..893766e 100644
--- a/usr.bin/enigma/enigma.c
+++ b/usr.bin/enigma/enigma.c
@@ -41,9 +41,15 @@ setup(char *pw)
char salt[3];
unsigned rnd;
int32_t seed;
+ char *cryptpw;
strlcpy(salt, pw, sizeof(salt));
- memcpy(buf, crypt(pw, salt), sizeof(buf));
+ cryptpw = crypt(pw, salt);
+ if (cryptpw == NULL) {
+ fprintf(stderr, "crypt(3) failure\n");
+ exit(1);
+ }
+ memcpy(buf, cryptpw, sizeof(buf));
seed = 123;
for (i=0; i<13; i++)
seed = seed*buf[i] + i;
OpenPOWER on IntegriCloud