invalid 3-octet multibyte sequences are stripped to 1 not 2 bytes

This commit is contained in:
tg 2008-04-19 17:25:49 +00:00
parent 7ddf56dbbc
commit 3e728f7797
1 changed files with 2 additions and 2 deletions

4
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.120 2008/04/19 17:21:52 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.121 2008/04/19 17:25:49 tg Exp $");
/* tty driver characters we are interested in */
typedef struct {
@ -827,7 +827,7 @@ utf_cptradj(const char *src, const char **dst)
len = 1;
if (len > 2)
if ((*(const unsigned char *)(src + 2) & 0xC0) != 0x80)
len = 2;
len = 1;
if (dst)
*dst = src + len;
return (len);