mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-03 04:49:41 +00:00
immutable: fix detection of truncated shares to take into account the fieldsize -- either 4 or 8
This commit is contained in:
parent
21e0ff97f2
commit
54787771c3
@ -371,8 +371,8 @@ class ReadBucketProxy:
|
|||||||
offset = self._offsets['uri_extension']
|
offset = self._offsets['uri_extension']
|
||||||
d = self._read(offset, self._fieldsize)
|
d = self._read(offset, self._fieldsize)
|
||||||
def _got_length(data):
|
def _got_length(data):
|
||||||
if len(data) != 4:
|
if len(data) != self._fieldsize:
|
||||||
raise LayoutInvalid("not enough bytes to encode URI length -- %d" % (len(data),))
|
raise LayoutInvalid("not enough bytes to encode URI length -- should be %d bytes long, not %d " % (self._fieldsize, len(data),))
|
||||||
length = struct.unpack(self._fieldstruct, data)[0]
|
length = struct.unpack(self._fieldstruct, data)[0]
|
||||||
if length >= 2**31:
|
if length >= 2**31:
|
||||||
# URI extension blocks are around 419 bytes long, so this must be corrupted.
|
# URI extension blocks are around 419 bytes long, so this must be corrupted.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user