From 2e4b2961ebf4750766d2e73c17d2b5584bef1006 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Sat, 22 May 2010 16:11:57 +0000 Subject: [PATCH] slight sanity checking git-svn-id: https://profuse.googlecode.com/svn/branches/v2@260 aa027e90-d47c-11dd-86d7-074df07e0730 --- Pascal/VolumeEntry.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Pascal/VolumeEntry.cpp b/Pascal/VolumeEntry.cpp index a4b41d1..f8c27b2 100644 --- a/Pascal/VolumeEntry.cpp +++ b/Pascal/VolumeEntry.cpp @@ -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);