summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2006-11-02 01:51:33 +0000
committerray <ray@openbsd.org>2006-11-02 01:51:33 +0000
commitb7468a6346d015690cabfcc1020aca2c30fe86d0 (patch)
tree79059c7ccd6ef912138cce656f8af376bfa3b4a2
parentAdd checks for fgets and properly overwrite newline. (diff)
downloadwireguard-openbsd-b7468a6346d015690cabfcc1020aca2c30fe86d0.tar.xz
wireguard-openbsd-b7468a6346d015690cabfcc1020aca2c30fe86d0.zip
Pass full buffer size to fgets.
OK moritz@ and jaredy@.
-rw-r--r--usr.bin/ftp/cmds.c6
-rw-r--r--usr.bin/ftp/util.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c
index f37acd35683..a1e5401fb59 100644
--- a/usr.bin/ftp/cmds.c
+++ b/usr.bin/ftp/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.53 2006/11/02 01:43:01 ray Exp $ */
+/* $OpenBSD: cmds.c,v 1.54 2006/11/02 01:51:33 ray Exp $ */
/* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */
/*
@@ -60,7 +60,7 @@
*/
#if !defined(lint) && !defined(SMALL)
-static const char rcsid[] = "$OpenBSD: cmds.c,v 1.53 2006/11/02 01:43:01 ray Exp $";
+static const char rcsid[] = "$OpenBSD: cmds.c,v 1.54 2006/11/02 01:51:33 ray Exp $";
#endif /* not lint and not SMALL */
/*
@@ -1275,7 +1275,7 @@ user(int argc, char *argv[])
(void)fputs("Account: ", ttyout);
(void)fflush(ttyout);
- if (fgets(acctname, sizeof(acctname) - 1, stdin) == NULL)
+ if (fgets(acctname, sizeof(acctname), stdin) == NULL)
goto fail;
if ((p = strchr(acctname, '\n')) != NULL)
*p = '\0';
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index 17366d6b5d7..60c1e397f71 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.44 2006/11/02 01:43:01 ray Exp $ */
+/* $OpenBSD: util.c,v 1.45 2006/11/02 01:51:33 ray Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*-
@@ -71,7 +71,7 @@
*/
#if !defined(lint) && !defined(SMALL)
-static const char rcsid[] = "$OpenBSD: util.c,v 1.44 2006/11/02 01:43:01 ray Exp $";
+static const char rcsid[] = "$OpenBSD: util.c,v 1.45 2006/11/02 01:51:33 ray Exp $";
#endif /* not lint and not SMALL */
/*
@@ -309,7 +309,7 @@ tryagain:
else
fprintf(ttyout, "Name (%s): ", host);
user = myname;
- if (fgets(tmp, sizeof(tmp) - 1, stdin) != NULL) {
+ if (fgets(tmp, sizeof(tmp), stdin) != NULL) {
char *p;
if ((p = strchr(tmp, '\n')) != NULL)