public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Bill Kendall <wkendall@sgi.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfsdump: fix bug restricting -f pathname length
Date: Thu, 24 Feb 2011 12:40:50 -0600	[thread overview]
Message-ID: <1298572850-15408-1-git-send-email-wkendall@sgi.com> (raw)

A temporary buffer storing the dump filename (-f) is smaller than
the otherwise allowed pathname length. This buffer is used to
extract the pathname from additional parameters specified as part
of the -f argument. As these parameters are an undocumented and
unused extension of the -f argument, simply remove this code.
Note that drive_alloc() always dups the given pathname, so
'optarg' is passed directly.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
---
 common/drive.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/common/drive.c b/common/drive.c
index f184afa..227fecd 100644
--- a/common/drive.c
+++ b/common/drive.c
@@ -137,10 +137,6 @@ drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
 	opterr = 0;
 	driveix = 0;
 	while ( ( c = getopt( argc, argv, GETOPT_CMDSTRING )) != EOF ) {
-		char optarray[100];
-		char *devname;
-		char *token;
-
 		switch ( c ) {
 		case GETOPT_DUMPDEST:
 			if ( ! optarg || optarg[ 0 ] == '-' ) {
@@ -151,21 +147,9 @@ drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
 				return BOOL_FALSE;
 			}
 
-			/* remove the device name from the rest of the
-			 * parameter string. note that strdup malloc()s
-			 * a string; important since optarray is an auto.
-			 */
-			ASSERT( strlen( optarg ) < sizeof( optarray ));
-			strncpy( optarray, optarg, sizeof( optarray ));
-			optarray[ sizeof( optarray ) - 1 ] = 0;
-			if ( ( token = strtok( optarray, "," )) == NULL ) {
-				token = optarray;
-			}
-			devname = strdup( token );
-
 			/* allocate a drive descriptor
 			 */
-			drivepp[ driveix ] = drive_alloc( devname, driveix );
+			drivepp[ driveix ] = drive_alloc( optarg, driveix );
 			driveix++;
 			break;
 		}
-- 
1.7.0.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2011-02-24 18:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 18:40 Bill Kendall [this message]
2011-02-25 19:27 ` [PATCH] xfsdump: fix bug restricting -f pathname length Alex Elder
2011-02-25 19:55   ` Bill Kendall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1298572850-15408-1-git-send-email-wkendall@sgi.com \
    --to=wkendall@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox