summaryrefslogtreecommitdiffstats
path: root/lotuswordpro/source/filter/tocread.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'lotuswordpro/source/filter/tocread.cxx')
-rw-r--r--lotuswordpro/source/filter/tocread.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx
index b6c32955411b..8e7e79a855e4 100644
--- a/lotuswordpro/source/filter/tocread.cxx
+++ b/lotuswordpro/source/filter/tocread.cxx
@@ -267,6 +267,13 @@ CBenTOCReader::ReadTOC()
if ((Err = cpContainer->SeekToPosition(Pos)) != BenErr_OK)
return Err;
+ const auto nRemainingSize = cpContainer->remainingSize();
+ if (Length > nRemainingSize)
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ Length = nRemainingSize;
+ }
+
#define STACK_BUFFER_SIZE 256
char sStackBuffer[STACK_BUFFER_SIZE];
char * sAllocBuffer;