[PATCH 2/9 V2] xfsdump: Fix overflow of "question" string in Media_prompt_erase()
Eric Sandeen
sandeen at sandeen.net
Thu Nov 13 12:00:07 CST 2014
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
More information about the xfs
mailing list