summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2005-03-11 22:16:16 +0000
committerotto <otto@openbsd.org>2005-03-11 22:16:16 +0000
commit3a2fd7148f8b4d39e4cb504806eb57dfcd03bdc8 (patch)
treeae02c1f7c63a1225bdfef448315db39edb0b107a
parentoops, off by 18 (diff)
downloadwireguard-openbsd-3a2fd7148f8b4d39e4cb504806eb57dfcd03bdc8.tar.xz
wireguard-openbsd-3a2fd7148f8b4d39e4cb504806eb57dfcd03bdc8.zip
PR 4135: detect illegal frame sizes; fix file transfer when using
emecs editing mode on the remote end; print [EOT] on ~. again, by making tip_abort able to finish. Largely from Hugo Villeneuve <harpagon at jwales dot EINTR dotnet> ok deraadt@ "looks good" miod@ Man page tweaks by jmc@
-rw-r--r--usr.bin/tip/cmds.c13
-rw-r--r--usr.bin/tip/tip.16
2 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c
index f875cdbd040..a68ced58a5f 100644
--- a/usr.bin/tip/cmds.c
+++ b/usr.bin/tip/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.20 2004/11/07 09:48:08 otto Exp $ */
+/* $OpenBSD: cmds.c,v 1.21 2005/03/11 22:16:16 otto Exp $ */
/* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: cmds.c,v 1.20 2004/11/07 09:48:08 otto Exp $";
+static const char rcsid[] = "$OpenBSD: cmds.c,v 1.21 2005/03/11 22:16:16 otto Exp $";
#endif /* not lint */
#include "tip.h"
@@ -112,7 +112,7 @@ cu_take(char cc)
printf("\r\n%s: cannot create\r\n", argv[1]);
return;
}
- (void)snprintf(line, sizeof(line), "cat %s;echo \01", argv[0]);
+ (void)snprintf(line, sizeof(line), "cat %s;echo ''|tr '\\012' '\\01'", argv[0]);
transfer(line, fd, "\01");
}
@@ -135,6 +135,12 @@ transfer(buf, fd, eofchars)
sig_t f;
char r;
+ if (number(value(FRAMESIZE)) > BUFSIZ || number(value(FRAMESIZE)) < 1) {
+ printf("framesize must be >= 1 and <= %d\r\n", BUFSIZ);
+ close(fd);
+ return;
+ }
+
parwrite(FD, buf, size(buf));
quit = 0;
kill(tipout_pid, SIGIOT);
@@ -642,6 +648,7 @@ tipabort(msg)
char *msg;
{
+ signal(SIGTERM, SIG_IGN);
kill(tipout_pid, SIGTERM);
disconnect(msg);
if (msg != NOSTR)
diff --git a/usr.bin/tip/tip.1 b/usr.bin/tip/tip.1
index 0c4ecded60a..4f3a6c0322e 100644
--- a/usr.bin/tip/tip.1
+++ b/usr.bin/tip/tip.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tip.1,v 1.31 2004/11/07 18:19:53 jmc Exp $
+.\" $OpenBSD: tip.1,v 1.32 2005/03/11 22:16:16 otto Exp $
.\" $NetBSD: tip.1,v 1.7 1994/12/08 09:31:05 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@@ -182,7 +182,7 @@ host.
The put command causes the remote
.Ux
system to run the command string
-.Dq cat > 'to' ,
+.Ic cat > 'to' ,
while
.Nm
sends it the
@@ -208,7 +208,7 @@ file defaults to the
.Dq from
file name if it isn't specified.
The remote host executes the command string
-.Dq cat 'from';echo ^A
+.Ic cat 'from';echo ''|tr '\e012' '\e01'
to send the file to
.Nm tip .
.It Ic \&~|