Skip to content

Commit 22f062a

Browse files
skyfish4tbjayrm
authored andcommitted
Fixed: in the process of converting double byte characters (such as Chinese characters), the wrong buffer length was obtained.
(cherry picked from commit 06d5e0d)
1 parent f0898f8 commit 22f062a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/rtlib/strw_convfrom_str.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ FBCALL FB_WCHAR *fb_StrToWstr( const char *src )
6161
if( src == NULL )
6262
return NULL;
6363

64-
chars = strlen( src );
64+
chars = mbstowcs( NULL, src, 0 );
6565
if( chars == 0 )
6666
return NULL;
6767

src/rtlib/strw_convto_str.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ FBCALL FBSTRING *fb_WstrToStr( const FB_WCHAR *src )
7272
if( src == NULL )
7373
return &__fb_ctx.null_desc;
7474

75-
chars = fb_wstr_Len( src );
75+
chars = wcstombs( NULL, src, 0 );
7676
if( chars == 0 )
7777
return &__fb_ctx.null_desc;
7878

0 commit comments

Comments
 (0)