Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.bin/uuencode Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/b1f9c48fc61c
branches:  netbsd-7
changeset: 798337:b1f9c48fc61c
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Sep 11 12:22:27 2014 +0000

description:
Pull up following revision(s) (requested by dholland in ticket #87):
        usr.bin/uuencode/uuencode.c: revision 1.16
        usr.bin/uuencode/uuencode.1: revision 1.23
        usr.bin/uuencode/uuencode.1: revision 1.24
        usr.bin/uuencode/uuencode.1: revision 1.25
        usr.bin/uuencode/uuencode.1: revision 1.26
Clarify usage message and improve documentation; pursuant to PR 49177.

diffstat:

 usr.bin/uuencode/uuencode.1 |  70 +++++++++++++++++++++++++++------------------
 usr.bin/uuencode/uuencode.c |   7 ++-
 2 files changed, 46 insertions(+), 31 deletions(-)

diffs (155 lines):

diff -r beb9a9e359f3 -r b1f9c48fc61c usr.bin/uuencode/uuencode.1
--- a/usr.bin/uuencode/uuencode.1       Thu Sep 11 12:17:10 2014 +0000
+++ b/usr.bin/uuencode/uuencode.1       Thu Sep 11 12:22:27 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: uuencode.1,v 1.22 2013/01/28 16:08:02 apb Exp $
+.\"    $NetBSD: uuencode.1,v 1.22.8.1 2014/09/11 12:22:27 martin Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)uuencode.1 8.1 (Berkeley) 6/6/93
 .\"
-.Dd January 28, 2012
+.Dd September 6, 2014
 .Dt UUENCODE 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nm
 .Op Fl m
 .Op Ar inputfile
-.Ar outputname
+.Ar headername
 .Nm uudecode
 .Op Fl m
 .Op Fl p | Fl o Ar outputfile
@@ -58,46 +58,49 @@
 .Bl -tag -width ".Fl m"
 .It Fl m
 Use base64 encoding.
-The default is that
-.Nm
-uses the historical uuencode algorithm,
-and
-.Nm uudecode
-automatically detects the encoding.
-.It Fl o Ar outputname
+For
+.Nm ,
+the historical uuencode algorithm is the default.
+For
+.Nm uudecode ,
+by default the encoding is automatically detected.
+.It Fl o Ar outputfile
 .Po Nm uudecode No only . Pc
-Use the specified
-.Ar outputname
-as the name of the output file.
-The default is that
+Send the decoded output data to
+.Ar outputfile .
+By default,
 .Nm uudecode
-obtains the name of the output file from the data stream, where
-.Nm
-would have recorded it.
+uses the
+.Ar headername
+recorded in the header of the encoded data stream.
 .It Fl p
 .Po Nm uudecode No only . Pc
-Write the decoded file to stdout instead of to a named file.
+Write the decoded file to standard output instead of to a file.
 .El
 .Pp
 .Nm
 reads
 .Ar inputfile
 (or by default the standard input) and writes an encoded version
-to the standard output.
+to (always) the standard output.
 The encoding uses only printing
 .Tn ASCII
-characters and includes the
-mode of the file and the operand
-.Ar outputname
-for use by
-.Nm uudecode .
+characters suitable for text-only transport media.
+The string
+.Ar headername
+is inserted into the output header as the
+.Ar outputfile
+to use at
+.Nm uudecode
+time.
+The header also includes the mode (permissions) of the file.
 .Pp
 .Nm uudecode
 transforms
 .Em uuencoded
 files (or by default, the standard input) into the original form.
 The resulting file is named
-.Ar outputname
+.Ar headername
 as recorded in the encoded file,
 or as specified by the
 .Fl o
@@ -112,6 +115,9 @@
 instead of to a named file.
 .Nm uudecode
 ignores any leading and trailing lines.
+.Pp
+The encoded form of the file is expanded by 35%.
+Every 3 bytes become 4 plus control information.
 .Sh EXIT STATUS
 The
 .Nm uudecode
@@ -156,6 +162,14 @@
 .Nm
 utilities appeared in
 .Bx 4.0 .
-.Sh BUGS
-The encoded form of the file is expanded by 35% (3 bytes become 4 plus
-control information).
+.Sh SECURITY CONSIDERATIONS
+When using
+.Nm uudecode
+with files coming from dubious sources,
+always either explicitly pass the
+.Fl o
+option or check the header (the first line) of the encoded file for
+safety.
+Blindly using a
+.Ar headername
+from a hostile source can overwrite important files.
diff -r beb9a9e359f3 -r b1f9c48fc61c usr.bin/uuencode/uuencode.c
--- a/usr.bin/uuencode/uuencode.c       Thu Sep 11 12:17:10 2014 +0000
+++ b/usr.bin/uuencode/uuencode.c       Thu Sep 11 12:22:27 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uuencode.c,v 1.15 2011/09/16 15:39:30 joerg Exp $      */
+/*     $NetBSD: uuencode.c,v 1.15.20.1 2014/09/11 12:22:27 martin Exp $        */
 
 /*-
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)uuencode.c 8.2 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: uuencode.c,v 1.15 2011/09/16 15:39:30 joerg Exp $");
+__RCSID("$NetBSD: uuencode.c,v 1.15.20.1 2014/09/11 12:22:27 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -195,7 +195,8 @@
 static void
 usage(void)
 {
-       (void)fprintf(stderr, "usage: %s [-m] [inputfile] outputname\n",
+       (void)fprintf(stderr,
+                     "usage: %s [-m] [inputfile] headername > encodedfile\n",
                      getprogname());
        exit(1);
 }



Home | Main Index | Thread Index | Old Index