]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/storage/immutable.py
immutable: prevent clients from reading past the end of share data, which would allow...
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / storage / immutable.py
index b7c4a9f9eaa0a5c29861c22d8219bb8b90bfccfc..a50ff422d607c13845584cc3ba6556630e5d86dc 100644 (file)
@@ -83,11 +83,9 @@ class ShareFile:
     def read_share_data(self, offset, length):
         precondition(offset >= 0)
         # reads beyond the end of the data are truncated. Reads that start
-        # beyond the end of the data return an empty string. I wonder why
-        # Python doesn't do the following computation for me?
+        # beyond the end of the data return an empty string.
         seekpos = self._data_offset+offset
-        fsize = os.path.getsize(self.home)
-        actuallength = max(0, min(length, fsize-seekpos))
+        actuallength = max(0, min(length, self._lease_offset-seekpos))
         if actuallength == 0:
             return ""
         f = open(self.home, 'rb')