summaryrefslogtreecommitdiff
authorerik <erik>2007-01-26 20:26:25 (UTC)
committer erik <erik>2007-01-26 20:26:25 (UTC)
commit4688f98202f590ec6af6c2e66a49dd2f80536083 (patch) (side-by-side diff)
tree326c92aef3382b804d51aa9a66f4148ebc91860b
parentcc5b326a212414a612838b0041e6077477ebbc70 (diff)
downloadopie-4688f98202f590ec6af6c2e66a49dd2f80536083.zip
opie-4688f98202f590ec6af6c2e66a49dd2f80536083.tar.gz
opie-4688f98202f590ec6af6c2e66a49dd2f80536083.tar.bz2
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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/plucker_base.cpp6
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
@@ -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;