This is an automated email from the ASF dual-hosted git repository.

borisk pushed a commit to branch xerces-3.0
in repository https://gitbox.apache.org/repos/asf/xerces-c.git

commit 241263bd15e5067f0c0a4bd826e71efb27f06791
Author: John Snelson <jo...@apache.org>
AuthorDate: Mon Mar 30 12:07:24 2009 +0000

    Port the TranscodeToStr and TranscodeFromStr fixes to the xerces-3.0 branch 
[#XERCESC-1858]
    
    
    git-svn-id: 
https://svn.apache.org/repos/asf/xerces/c/branches/xerces-3.0@759938 
13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/util/TransService.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xercesc/util/TransService.cpp 
b/src/xercesc/util/TransService.cpp
index 69d49c7..50694ec 100644
--- a/src/xercesc/util/TransService.cpp
+++ b/src/xercesc/util/TransService.cpp
@@ -604,7 +604,7 @@ void TranscodeToStr::transcode(const XMLCh *in, XMLSize_t 
len, XMLTranscoder* tr
     XMLSize_t allocSize = len * sizeof(XMLCh);
     fString = (XMLByte*)fMemoryManager->allocate(allocSize);
 
-    XMLSize_t charsRead;
+    XMLSize_t charsRead = 0;
     XMLSize_t charsDone = 0;
 
     while(true) {
@@ -623,7 +623,7 @@ void TranscodeToStr::transcode(const XMLCh *in, XMLSize_t 
len, XMLTranscoder* tr
     }
 
     // null terminate
-    if(fBytesWritten > (allocSize - 4)) {
+    if(fBytesWritten + 4 > allocSize) {
         allocSize = fBytesWritten + 4;
         XMLByte *newBuf = (XMLByte*)fMemoryManager->allocate(allocSize);
         memcpy(newBuf, fString, fBytesWritten);
@@ -683,7 +683,7 @@ void TranscodeFromStr::transcode(const XMLByte *in, 
XMLSize_t length, XMLTransco
     ArrayJanitor<unsigned char> charSizes((unsigned 
char*)fMemoryManager->allocate(csSize * sizeof(unsigned char)),
                                           fMemoryManager);
 
-    XMLSize_t bytesRead;
+    XMLSize_t bytesRead = 0;
     XMLSize_t bytesDone = 0;
 
     while(true) {


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to