author | erik <erik> | 2007-01-26 20:26:25 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-26 20:26:25 (UTC) |
commit | 4688f98202f590ec6af6c2e66a49dd2f80536083 (patch) (side-by-side diff) | |
tree | 326c92aef3382b804d51aa9a66f4148ebc91860b | |
parent | cc5b326a212414a612838b0041e6077477ebbc70 (diff) | |
download | opie-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.
-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 @@ -45,5 +45,6 @@ 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 @@ -61,5 +62,6 @@ unsuspend(); { 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) { |