slight sanity checking

git-svn-id: https://profuse.googlecode.com/svn/branches/v2@260 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
ksherlock 2010-05-22 16:11:57 +00:00
parent ef4f906d70
commit 2e4b2961eb
1 changed files with 10 additions and 0 deletions

View File

@ -176,11 +176,21 @@ VolumeEntry::~VolumeEntry()
void VolumeEntry::init(void *vp)
{
#undef __METHOD__
#define __METHOD__ "VolumeEntry::init"
Entry::init(vp);
_fileNameLength = Read8(vp, 6);
// verify filenamelength <= 7
if (_fileNameLength > 7)
throw new ProFUSE::Exception(__METHOD__ ": invalid name length");
// verify fileKind == 0
// verify _fileCount reasonable
// verify _lastVolumeBlock reasonable
// verify _blocks reasonable.
std::memcpy(_fileName, 7 + (uint8_t *)vp, _fileNameLength);