diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-08 13:58:11 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-08 13:58:11 +0000 |
commit | 18d72416ee6d304dbc7155a7450e3610cd08469e (patch) | |
tree | 0d96ff4d684023eac68a0bf4ca5e9e8566ee801d /bin | |
parent | e6bbff8e72d3823f576dc11b78661638f576114e (diff) |
Prevent a segmentation fault when ed receives a signal while being in
getpass().
With input by and ok otto
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ed/cbc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 891757a2896..cf8c070592b 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbc.c,v 1.14 2006/04/25 15:41:07 deraadt Exp $ */ +/* $OpenBSD: cbc.c,v 1.15 2008/06/08 13:58:10 tobias Exp $ */ /* $NetBSD: cbc.c,v 1.9 1995/03/21 09:04:36 cgd Exp $ */ /* cbc.c: This file contains the encryption routines for the ed line editor */ @@ -40,7 +40,7 @@ #if 0 static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; #else -static char rcsid[] = "$OpenBSD: cbc.c,v 1.14 2006/04/25 15:41:07 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cbc.c,v 1.15 2008/06/08 13:58:10 tobias Exp $"; #endif #endif /* not lint */ @@ -170,7 +170,7 @@ get_keyword(void) /* * get the key */ - if (*(p = getpass("Enter key: "))) { + if ((p = getpass("Enter key: ")) != NULL && *p != '\0') { /* * copy it, nul-padded, into the key area |