summaryrefslogtreecommitdiffstats
path: root/lib/libskey
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2007-05-17 04:34:50 +0000
committerray <ray@openbsd.org>2007-05-17 04:34:50 +0000
commit860b7643ef558d16a3bf34a7c81e5dfcf50f2adf (patch)
tree39b5b362c08cf73ce82a086cbd08baa46d6d9ce8 /lib/libskey
parentLSRCS should refer to the C source version of asm files 'put it in' deraadt@ (diff)
downloadwireguard-openbsd-860b7643ef558d16a3bf34a7c81e5dfcf50f2adf.tar.xz
wireguard-openbsd-860b7643ef558d16a3bf34a7c81e5dfcf50f2adf.zip
Check fgets return value, from Charles Longeau.
OK millert@.
Diffstat (limited to 'lib/libskey')
-rw-r--r--lib/libskey/skeysubr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c
index 7e0f5bf996a..079b2a0a136 100644
--- a/lib/libskey/skeysubr.c
+++ b/lib/libskey/skeysubr.c
@@ -9,7 +9,7 @@
*
* S/Key misc routines.
*
- * $OpenBSD: skeysubr.c,v 1.29 2006/04/10 08:06:08 deraadt Exp $
+ * $OpenBSD: skeysubr.c,v 1.30 2007/05/17 04:34:50 ray Exp $
*/
#include <stdio.h>
@@ -284,7 +284,8 @@ readpass(char *buf, int n)
/* Catch SIGINT and save old signal handler */
old_handler = signal(SIGINT, trapped);
- (void)fgets(buf, n, stdin);
+ if (fgets(buf, n, stdin) == NULL)
+ buf[0] = '\0';
rip(buf);
(void)putc('\n', stderr);
@@ -304,7 +305,8 @@ readpass(char *buf, int n)
char *
readskey(char *buf, int n)
{
- (void)fgets(buf, n, stdin);
+ if (fgets(buf, n, stdin) == NULL)
+ buf[0] = '\0';
rip(buf);
sevenbit(buf);