From 33ed650231de6287a6ba6ea61b00e548db03c11c Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 19 Mar 2004 04:33:21 +0000 Subject: [PATCH] possible bug --- wince/ceutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wince/ceutil.c b/wince/ceutil.c index 546624be2..b9e00b393 100755 --- a/wince/ceutil.c +++ b/wince/ceutil.c @@ -69,9 +69,12 @@ ceGetDlgItemText( HWND hDlg, XP_U16 id, XP_UCHAR* buf, XP_U16* bLen ) gotLen = (XP_U16)SendDlgItemMessage( hDlg, id, WM_GETTEXT, len, (long)wbuf ); if ( gotLen > 0 ) { + XP_ASSERT( gotLen < len ); + if ( gotLen >= len ) { + gotLen = len - 1; + } gotLen = WideCharToMultiByte( CP_ACP, 0, wbuf, gotLen, buf, len, NULL, NULL ); - XP_ASSERT( gotLen < len ); *bLen = gotLen; buf[gotLen] = '\0'; } else {