butc: don't pass NULL to strcpy in RcreateDump

volumesetNamePtr can return a null pointer in certain error
conditions.  Check for this and return BUDB_BADARGUMENT rather
than dumping core.

Change-Id: If0ce509c964211ffa591d8e095b7c32c51ae7bc3
Reviewed-on: http://gerrit.openafs.org/7890
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Garrett Wollman 2012-07-27 19:50:42 -04:00 committed by Derrick Brashear
parent 5237d3d232
commit fdb4ec2e27

View File

@ -906,6 +906,7 @@ RcreateDump(struct tapeScanInfo *tapeScanInfoPtr,
struct volumeHeader *volHeaderPtr)
{
afs_int32 code;
const char *volsetName;
struct butm_tapeLabel *dumpLabelPtr = &tapeScanInfoPtr->dumpLabel;
struct budb_dumpEntry *dumpEntryPtr = &tapeScanInfoPtr->dumpEntry;
@ -919,8 +920,10 @@ RcreateDump(struct tapeScanInfo *tapeScanInfoPtr,
dumpEntryPtr->flags = 0;
dumpEntryPtr->incTime = 0;
dumpEntryPtr->nVolumes = 0;
strcpy(dumpEntryPtr->volumeSetName,
volumesetNamePtr(volHeaderPtr->dumpSetName));
volsetName = volumesetNamePtr(volHeaderPtr->dumpSetName);
if (volsetName == NULL)
return BUDB_BADARGUMENT;
strcpy(dumpEntryPtr->volumeSetName, volsetName);
strcpy(dumpEntryPtr->dumpPath, dumpLabelPtr->dumpPath);
strcpy(dumpEntryPtr->name, volHeaderPtr->dumpSetName);
default_tapeset(&dumpEntryPtr->tapes, volHeaderPtr->dumpSetName);