summaryrefslogtreecommitdiffstats
path: root/usr.bin/tip
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1997-08-25 05:02:11 +0000
committerimp <imp@FreeBSD.org>1997-08-25 05:02:11 +0000
commit4760384ee3898fd9f6ff4352bf2b0b1cae4ec150 (patch)
treecd5072eb6571914bb87be66189b294cecc5ed78c /usr.bin/tip
parent60c2d3cd1964df62fc3fd4a50ad06630b48c544a (diff)
downloadFreeBSD-src-4760384ee3898fd9f6ff4352bf2b0b1cae4ec150.zip
FreeBSD-src-4760384ee3898fd9f6ff4352bf2b0b1cae4ec150.tar.gz
Change from using sys/param.h and MAXPATHLEN to using limits.h and PATH_MAX
to avoid the NOFILE problem. Back out NOFILE kludge. Fix unexploitable buffer overflow in tipout.c. Reviewed by: millert@openbsd.org (tipout.c) Submitted by: millert@openbsd.org (rest of idea)
Diffstat (limited to 'usr.bin/tip')
-rw-r--r--usr.bin/tip/tip/cmds.c4
-rw-r--r--usr.bin/tip/tip/tip.c6
-rw-r--r--usr.bin/tip/tip/tip.h8
-rw-r--r--usr.bin/tip/tip/tipout.c4
4 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/tip/tip/cmds.c b/usr.bin/tip/tip/cmds.c
index 335763e..7a9f2d8 100644
--- a/usr.bin/tip/tip/cmds.c
+++ b/usr.bin/tip/tip/cmds.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: cmds.c,v 1.3 1997/08/18 07:16:00 charnier Exp $";
+ "$Id: cmds.c,v 1.4 1997/08/22 22:14:15 imp Exp $";
#endif /* not lint */
#include "tipconf.h"
@@ -787,7 +787,7 @@ setscript()
void
chdirectory()
{
- char dirname[MAXPATHLEN];
+ char dirname[PATH_MAX];
register char *cp = dirname;
if (prompt("[cd] ", dirname, sizeof(dirname))) {
diff --git a/usr.bin/tip/tip/tip.c b/usr.bin/tip/tip/tip.c
index 1ddaa64..61726af 100644
--- a/usr.bin/tip/tip/tip.c
+++ b/usr.bin/tip/tip/tip.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: tip.c,v 1.3 1997/08/18 07:16:06 charnier Exp $";
+ "$Id: tip.c,v 1.4 1997/08/22 22:14:15 imp Exp $";
#endif /* not lint */
/*
@@ -88,7 +88,7 @@ void setparity __P((char *));
void pwrite __P((int, char *, int));
char escape __P((void));
void tipin __P((void));
-int prompt __P((char *, char *, int));
+int prompt __P((char *, char *, size_t));
void unraw __P((void));
void shell_uid __P((void));
void daemon_uid __P((void));
@@ -380,7 +380,7 @@ int
prompt(s, p, sz)
char *s;
register char *p;
- int sz;
+ size_t sz;
{
register char *b = p;
sig_t oint, oquit;
diff --git a/usr.bin/tip/tip/tip.h b/usr.bin/tip/tip/tip.h
index fb7e6db..759c154 100644
--- a/usr.bin/tip/tip/tip.h
+++ b/usr.bin/tip/tip/tip.h
@@ -42,7 +42,7 @@
#include <machine/endian.h>
#include <sys/file.h>
#include <sys/time.h>
-#include <sys/param.h>
+#include <limits.h>
#if HAVE_TERMIOS
#include <sys/ioctl.h> /* for TIOCHPCL */
@@ -290,8 +290,8 @@ int stoprompt; /* for interrupting a prompt session */
int timedout; /* ~> transfer timedout */
int cumode; /* simulating the "cu" program */
-char fname[MAXPATHLEN]; /* file name buffer for ~< */
-char copyname[MAXPATHLEN]; /* file name buffer for ~> */
+char fname[PATH_MAX]; /* file name buffer for ~< */
+char copyname[PATH_MAX]; /* file name buffer for ~> */
char ccc; /* synchronization character */
char ch; /* for tipout */
char *uucplock; /* name of lock file for uucp's */
@@ -317,7 +317,7 @@ extern void disconnect __P((char *));
extern void shell_uid __P((void));
extern void unraw __P((void));
extern void pwrite __P((int, char *, int));
-extern int prompt __P((char *, char *, int));
+extern int prompt __P((char *, char *, size_t));
extern void consh __P((int));
extern void tipabort __P((char *));
diff --git a/usr.bin/tip/tip/tipout.c b/usr.bin/tip/tip/tipout.c
index 50cbb7c..d9417d6 100644
--- a/usr.bin/tip/tip/tipout.c
+++ b/usr.bin/tip/tip/tipout.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: tipout.c,v 1.4 1997/08/18 07:16:08 charnier Exp $";
#endif /* not lint */
#include "tip.h"
@@ -74,7 +74,7 @@ intEMT()
char reply;
read(fildes[0], &c, 1);
- while (c != '\n') {
+ while (c != '\n' && pline - line < sizeof(line)) {
*pline++ = c;
read(fildes[0], &c, 1);
}
OpenPOWER on IntegriCloud