[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Use strdup in dd to avoid changing argv elements
From: |
Adam Goode |
Subject: |
[PATCH] Use strdup in dd to avoid changing argv elements |
Date: |
Mon, 28 Jan 2008 01:14:02 -0500 |
User-agent: |
Thunderbird 2.0.0.9 (X11/20071209) |
Hi,
Right now, dd uses strchr to do some parsing of argv. This messes up how
dd appears in ps.
Here is a very simple solution to this problem. Yes, it does not free
memory. But does it matter? dd is just a standalone application.
(Pointed out by Benjamin Gilbert.)
Adam
---
src/dd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/dd.c b/src/dd.c
index cc1ba0c..b8ab8a9 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -877,7 +877,7 @@ scanargs (int argc, char **argv)
{
char *name, *val;
- name = argv[i];
+ name = strdup(argv[i]);
val = strchr (name, '=');
if (val == NULL)
{
--
1.5.3.8
signature.asc
Description: OpenPGP digital signature
- [PATCH] Use strdup in dd to avoid changing argv elements,
Adam Goode <=
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Jim Meyering, 2008/01/28
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Eric Blake, 2008/01/28
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Jim Meyering, 2008/01/28
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Andreas Schwab, 2008/01/28
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Paul Eggert, 2008/01/29
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Jim Meyering, 2008/01/30
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Paul Eggert, 2008/01/30
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Jim Meyering, 2008/01/31
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Andreas Schwab, 2008/01/28
- Re: [PATCH] Use strdup in dd to avoid changing argv elements, Eric Blake, 2008/01/28