diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2003-04-17 12:24:15 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2003-04-17 12:24:15 +0000 |
commit | 96847c18dca75dd04385d9ceb963772946ca8948 (patch) | |
tree | 383d28f6e9bb70a66331fef0d13f9859beafdd49 | |
parent | 9a47aa60b660fccd1ab63cad9364eba1d135ab51 (diff) |
INTEGRATION: CWS os8 (1.11.72); FILE MERGED
2003/04/10 08:52:35 os 1.11.72.1: #108626# ::ReadCString() now reads more than 256 characters
-rw-r--r-- | tools/source/stream/stream.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index a16cbc7533e3..cab72767a788 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -2,9 +2,9 @@ * * $RCSfile: stream.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: vg $ $Date: 2003-04-15 17:55:55 $ + * last change: $Author: vg $ $Date: 2003-04-17 13:24:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -908,6 +908,7 @@ BOOL SvStream::ReadCString( ByteString& rStr ) while( !bEnd && !GetError() ) { USHORT nLen = (USHORT)Read( buf, sizeof(buf)-1 ); + USHORT nReallyRead = nLen; if( !nLen ) break; @@ -915,7 +916,11 @@ BOOL SvStream::ReadCString( ByteString& rStr ) while( *pPtr && nLen ) ++pPtr, --nLen; - bEnd = 0 == *pPtr; + bEnd = ( nReallyRead < sizeof(buf)-1 ) // read less than attempted to read + || ( ( nLen > 0 ) // OR it is inside the block we read + && ( 0 == *pPtr ) // AND found a string terminator + ); + rStr.Append( buf, pPtr - buf ); } |