diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2006-05-27 23:42:09 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2006-05-27 23:42:09 +0000 |
commit | 1c9cc2a54fa23fb1279fcd37fe2fa7b7ee46faa9 (patch) | |
tree | c1ce3ccc3af6b3e890448d6119ce213a076d3989 /usr.bin/encrypt | |
parent | ffb047ab64e1f172ef9a9ae36b8a06fdb69ef5f1 (diff) |
Handle crypt(3) returning NULL. Found by Gustavo C. Pereira.
ok deraadt@
Diffstat (limited to 'usr.bin/encrypt')
-rw-r--r-- | usr.bin/encrypt/encrypt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/encrypt/encrypt.c b/usr.bin/encrypt/encrypt.c index f54e3ccaeab..d5aa4d3c625 100644 --- a/usr.bin/encrypt/encrypt.c +++ b/usr.bin/encrypt/encrypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: encrypt.c,v 1.22 2006/04/02 04:13:07 deraadt Exp $ */ +/* $OpenBSD: encrypt.c,v 1.23 2006/05/27 23:42:08 moritz Exp $ */ /* * Copyright (c) 1996, Jason Downs. All rights reserved. @@ -83,7 +83,7 @@ trim(char *line) void print_passwd(char *string, int operation, void *extra) { - char msalt[3], *salt; + char msalt[3], *salt, *cryptstr; login_cap_t *lc; int pwd_gensalt(char *, int, login_cap_t *, char); void to64(char *, u_int32_t, int n); @@ -128,7 +128,9 @@ print_passwd(char *string, int operation, void *extra) break; } - (void)fputs(crypt(string, salt), stdout); + if ((cryptstr = crypt(string, salt)) == NULL) + errx(1, "crypt failed"); + fputs(cryptstr, stdout); } int |