diff -r 78488edd8873 -r ecd216d00146 core/vm/sp_vm_basecontext.cpp --- a/core/vm/sp_vm_basecontext.cpp Sun Nov 12 09:51:39 2006 +0000 +++ b/core/vm/sp_vm_basecontext.cpp Sun Nov 12 13:13:12 2006 +0000 @@ -542,7 +542,7 @@ int count; int bytecount = 0; - for(count=1; (*c & 0xC0) == 0x80; count++) + for (count=1; (*c & 0xC0) == 0x80; count++) { c--; } @@ -600,7 +600,7 @@ } memcpy(dest, source, len); - if ((dest[len] & 1<<7) && needtocheck) + if ((dest[len-1] & 1<<7) && needtocheck) { len -= __CheckValidChar(dest+len-1); }