From 4688f98202f590ec6af6c2e66a49dd2f80536083 Mon Sep 17 00:00:00 2001 From: erik Date: Fri, 26 Jan 2007 20:26:25 +0000 Subject: The Expand call does not check for null termination of the URL strings that it is expanding. Since strlen() is used with the URLs after Expand is used, it is good idea to make sure that Expand terminates the strings. This commit changes that so that the URL strings are guaranteed to be terminated after expansion. --- (limited to 'noncore') 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 @@ -44,7 +44,8 @@ void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buff 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 { @@ -60,7 +61,8 @@ unsuspend(); 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; -- cgit v0.9.0.2