All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs@oss.sgi.com
Subject: Re: [PATCH 2/9 V2] xfsdump: Fix overflow of "question" string in Media_prompt_erase()
Date: Thu, 13 Nov 2014 12:00:07 -0600	[thread overview]
Message-ID: <5464F1A7.20008@sandeen.net> (raw)
In-Reply-To: <20141113173813.GA9959@infradead.org>

On 11/13/14 11:38 AM, Christoph Hellwig wrote:
>> +	asprintf( &question, 
>> +		 "overwrite data on media in drive %u?\n",
>>  		 (unsigned int)drivep->d_index );
> 
> Where is the error handling?

Well, ok.

The error handling ahead of this is crap; if the
function returns !ok, we change the media:

                                ok = Media_prompt_overwrite( drivep );
                                if ( intr_allowed && cldmgr_stop_requested( )) {
                                        return RV_INTR;
                                }
                                if ( ! ok ) {
                                        goto changemedia;
                                }

I don't want to try to understand and rework all the ways we can
back out of this if we don't have ~100 bytes available.

So, what would you prefer:

I could make a 110-byte array, and snprintf max 110 bytes to it.
Or I could asprintf, and exit the whole program if it fails.

I'm not trying to make xfsdump perfect, I'm trying to make it
suck less. ;)

-Eric

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

  reply	other threads:[~2014-11-13 18:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 18:57 [PATCH 0/9] Random xfsdump fixes Eric Sandeen
2014-11-12 18:57 ` [PATCH 1/9] xfsdump: don't try to close fd from failed open Eric Sandeen
2014-11-12 18:57 ` [PATCH 2/9] xfsdump: Fix overflow of "question" string in Media_prompt_erase() Eric Sandeen
2014-11-12 18:58   ` Christoph Hellwig
2014-11-12 19:05   ` [PATCH 2/9 V2] " Eric Sandeen
2014-11-13 17:38     ` Christoph Hellwig
2014-11-13 18:00       ` Eric Sandeen [this message]
2014-11-12 18:57 ` [PATCH 3/9] xfsdump: fix wrong test for hard stack limit change failure Eric Sandeen
2014-11-12 18:57 ` [PATCH 4/9] xfsdump: remove pointless if (dirty); Eric Sandeen
2014-11-13 17:35   ` Mark Tinguely
2014-11-13 17:47     ` Eric Sandeen
2014-11-13 19:02       ` Mark Tinguely
2014-11-12 18:57 ` [PATCH 5/9] xfsdump: remove some unreachable code Eric Sandeen
2014-11-12 18:57 ` [PATCH 6/9] xfsdump: free suboptstrs if mlog_init1 fails Eric Sandeen
2014-11-12 18:57 ` [PATCH 7/9] xfsdump: free allocated persistent paths Eric Sandeen
2014-11-12 18:57 ` [PATCH 8/9] xfsdump: children[] is an array of child pointers, not of child structures Eric Sandeen
2014-11-12 18:57 ` [PATCH 9/9] xfsdump: fix uninit ackstr in content_mediachange_query() Eric Sandeen
2014-11-13 18:10   ` Mark Tinguely
2014-11-13 19:23     ` Eric Sandeen

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=5464F1A7.20008@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=hch@infradead.org \
    --cc=sandeen@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.