diff options
author | Tad Marshall <tad@10gen.com> | 2012-11-28 05:22:34 -0500 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2013-01-08 03:11:16 -0500 |
commit | c814cb28686e5336f3cbc3753dc120cbfc43a854 (patch) | |
tree | 3a62729ed75b626396d8bc37086d82107b730263 | |
parent | d5a4514a067350e10d17f83a15178a09fa662669 (diff) | |
download | mongo-c814cb28686e5336f3cbc3753dc120cbfc43a854.tar.gz |
SERVER-7787 Do not read character before checking count
Change the order of tests in copyString32to8counted() to check the count
of input characters before reading a possibly uninitialized character.
-rw-r--r-- | src/mongo/shell/linenoise_utf8.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/shell/linenoise_utf8.cpp b/src/mongo/shell/linenoise_utf8.cpp index d906c9676f2..dc6224dc236 100644 --- a/src/mongo/shell/linenoise_utf8.cpp +++ b/src/mongo/shell/linenoise_utf8.cpp @@ -238,7 +238,7 @@ size_t copyString32to8counted( UChar8* dest8, const UChar32* source32, size_t ou size_t outputUTF8ByteCount = 0; if ( outputBufferSizeInBytes ) { size_t reducedBufferSize = outputBufferSizeInBytes - 4; - while ( *source32 && charCount-- && outputUTF8ByteCount < reducedBufferSize ) { + while ( charCount-- && *source32 && outputUTF8ByteCount < reducedBufferSize ) { UChar32 c = *source32++; if ( c <= 0x7F ) { *dest8++ = c; |