aboutsummaryrefslogtreecommitdiff
path: root/bin/dd/args.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dd/args.c')
-rw-r--r--bin/dd/args.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c
index 6cd6de9..033179d 100644
--- a/bin/dd/args.c
+++ b/bin/dd/args.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: args.c,v 1.29 2018/01/03 19:12:20 schwarze Exp $ */
+/* $OpenBSD: args.c,v 1.30 2018/07/25 15:09:48 cheloha Exp $ */
/* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */
/*-
@@ -95,9 +95,9 @@ jcl(char **argv)
in.dbsz = out.dbsz = 512;
- while ((oper = *++argv) != NULL) {
- if ((oper = strdup(oper)) == NULL)
- errx(1, "out of memory");
+ while (*++argv != NULL) {
+ if ((oper = strdup(*argv)) == NULL)
+ err(1, NULL);
if ((arg = strchr(oper, '=')) == NULL)
errx(1, "unknown operand %s", oper);
*arg++ = '\0';
@@ -113,6 +113,7 @@ jcl(char **argv)
tmp.name);
ddflags |= ap->set;
ap->f(arg);
+ free(oper);
}
/* Final sanity checks. */
@@ -218,8 +219,8 @@ f_ibs(char *arg)
static void
f_if(char *arg)
{
-
- in.name = arg;
+ if ((in.name = strdup(arg)) == NULL)
+ err(1, NULL);
}
static void
@@ -233,8 +234,8 @@ f_obs(char *arg)
static void
f_of(char *arg)
{
-
- out.name = arg;
+ if ((out.name = strdup(arg)) == NULL)
+ err(1, NULL);
}
static void