X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fdrv%2Fvterm_termbuf.c;h=525f1a4b3d0034ede417839c2ed189eb7dc83dec;hb=a88ba0c5436470438a63241b126f926968ef558f;hp=7c2965660ebd5ef6b2c9c6f8e7babc1860e0ca86;hpb=450d8178a7ef1708f69f1f3e0def83a78cbd1cee;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/drv/vterm_termbuf.c b/KernelLand/Kernel/drv/vterm_termbuf.c index 7c296566..525f1a4b 100644 --- a/KernelLand/Kernel/drv/vterm_termbuf.c +++ b/KernelLand/Kernel/drv/vterm_termbuf.c @@ -15,24 +15,27 @@ */ void VT_int_PutString(tVTerm *Term, const Uint8 *Buffer, Uint Count) { - Uint32 val; int i; // Iterate for( i = 0; i < Count; i++ ) { // Handle escape sequences - if( Buffer[i] == 0x1B ) + if( Buffer[i] == 0x1B && Count - i > 1 ) { - i ++; - i += VT_int_ParseEscape(Term, (const char*)&Buffer[i]) - 1; - continue; + int ret = VT_int_ParseEscape(Term, (const char*)&Buffer[i+1], Count-(i+1)); + if( ret > 0 ) + { + i += ret; + continue; + } } // Fast check for non UTF-8 if( Buffer[i] < 128 ) // Plain ASCII VT_int_PutChar(Term, Buffer[i]); else { // UTF-8 + Uint32 val; i += ReadUTF8(&Buffer[i], &val) - 1; VT_int_PutChar(Term, val); }