Source-Changes-HG archive

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

[src/trunk]: src/bin/dd Copy argument before modifying it so that ps shows en...



details:   https://anonhg.NetBSD.org/src/rev/9766442e3456
branches:  trunk
changeset: 759973:9766442e3456
user:      enami <enami%NetBSD.org@localhost>
date:      Wed Dec 22 09:39:06 2010 +0000

description:
Copy argument before modifying it so that ps shows entire argument.
>From OpenBSD via FreeBSD.

diffstat:

 bin/dd/args.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 4a95f339e157 -r 9766442e3456 bin/dd/args.c
--- a/bin/dd/args.c     Wed Dec 22 09:12:28 2010 +0000
+++ b/bin/dd/args.c     Wed Dec 22 09:39:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $  */
+/*     $NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c     8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $");
+__RCSID("$NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -120,6 +120,12 @@
        in.dbsz = out.dbsz = 512;
 
        while ((oper = *++argv) != NULL) {
+               if ((oper = strdup(oper)) == NULL) {
+                       errx(EXIT_FAILURE,
+                           "unable to allocate space for the argument %s",
+                           *argv);
+                       /* NOTREACHED */
+               }
                if ((arg = strchr(oper, '=')) == NULL) {
                        errx(EXIT_FAILURE, "unknown operand %s", oper);
                        /* NOTREACHED */



Home | Main Index | Thread Index | Old Index