-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index 81614f5..849edfc 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp @@ -35,41 +35,43 @@ CPlucker_base::CPlucker_base() : compressedtextbuffer(NULL), bufferrec(-1), m_offset(0) //, urls(NULL) { /*printf("constructing:%x\n",fin);*/ } void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buffersize) { unsuspend(); if ((type%2 == 0) && (type != 14)) { - fread(buffer, reclen, sizeof(char), fin); + size_t bytes_read = fread(buffer, reclen, sizeof(char), fin); + buffer[bytes_read] = '\0'; } else { UInt8* readbuffer = NULL; if (reclen > compressedbuffersize) { readbuffer = new UInt8[reclen]; } else { readbuffer = compressedtextbuffer; } if (readbuffer != NULL) { fread(readbuffer, reclen, sizeof(char), fin); - (*m_decompress)(readbuffer, reclen, buffer, buffersize); + size_t bytes_read = (*m_decompress)(readbuffer, reclen, buffer, buffersize); + buffer[bytes_read] = '\0'; if (reclen > compressedbuffersize) { delete [] readbuffer; } } } } void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text) { _file = file_length; if (textlength == 0) |