mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
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:
parent
5237d3d232
commit
fdb4ec2e27
@ -906,6 +906,7 @@ RcreateDump(struct tapeScanInfo *tapeScanInfoPtr,
|
|||||||
struct volumeHeader *volHeaderPtr)
|
struct volumeHeader *volHeaderPtr)
|
||||||
{
|
{
|
||||||
afs_int32 code;
|
afs_int32 code;
|
||||||
|
const char *volsetName;
|
||||||
struct butm_tapeLabel *dumpLabelPtr = &tapeScanInfoPtr->dumpLabel;
|
struct butm_tapeLabel *dumpLabelPtr = &tapeScanInfoPtr->dumpLabel;
|
||||||
struct budb_dumpEntry *dumpEntryPtr = &tapeScanInfoPtr->dumpEntry;
|
struct budb_dumpEntry *dumpEntryPtr = &tapeScanInfoPtr->dumpEntry;
|
||||||
|
|
||||||
@ -919,8 +920,10 @@ RcreateDump(struct tapeScanInfo *tapeScanInfoPtr,
|
|||||||
dumpEntryPtr->flags = 0;
|
dumpEntryPtr->flags = 0;
|
||||||
dumpEntryPtr->incTime = 0;
|
dumpEntryPtr->incTime = 0;
|
||||||
dumpEntryPtr->nVolumes = 0;
|
dumpEntryPtr->nVolumes = 0;
|
||||||
strcpy(dumpEntryPtr->volumeSetName,
|
volsetName = volumesetNamePtr(volHeaderPtr->dumpSetName);
|
||||||
volumesetNamePtr(volHeaderPtr->dumpSetName));
|
if (volsetName == NULL)
|
||||||
|
return BUDB_BADARGUMENT;
|
||||||
|
strcpy(dumpEntryPtr->volumeSetName, volsetName);
|
||||||
strcpy(dumpEntryPtr->dumpPath, dumpLabelPtr->dumpPath);
|
strcpy(dumpEntryPtr->dumpPath, dumpLabelPtr->dumpPath);
|
||||||
strcpy(dumpEntryPtr->name, volHeaderPtr->dumpSetName);
|
strcpy(dumpEntryPtr->name, volHeaderPtr->dumpSetName);
|
||||||
default_tapeset(&dumpEntryPtr->tapes, volHeaderPtr->dumpSetName);
|
default_tapeset(&dumpEntryPtr->tapes, volHeaderPtr->dumpSetName);
|
||||||
|
Loading…
Reference in New Issue
Block a user