Hello, while implementing _mbsnbcat i found a problem in the search for the end of the destination string in _mbsncat: a multibyte character dosn't ever contain a '\0' byte so there is no need for the MSVCRT_isleadbyte. In case of a lead byte in front of the '\0' we wouldn't detect the end of the string and corrupt memory. License: LGPL, X11 Changelog: Michael Stefaniuc <mstefani@redhat.com> - multibyte characters don't contain a '\0' byte. Optimize the search for the end of the dst string in _mbsncat. Fixes a possible memory corruption when the byte immediately preceeding the '\0' is a lead byte. bye michael -- Michael Stefaniuc Tel.: +49-711-96437-199 System Administration Fax.: +49-711-96437-111 Red Hat GmbH Email: mstefani@redhat.com Hauptstaetterstr. 58 http://www.redhat.de/ D-70178 Stuttgart
Index: dlls/msvcrt/mbcs.c =================================================================== RCS file: /home/wine/wine/dlls/msvcrt/mbcs.c,v retrieving revision 1.24 diff -u -r1.24 mbcs.c --- dlls/msvcrt/mbcs.c 1 Feb 2003 00:59:22 -0000 1.24 +++ dlls/msvcrt/mbcs.c 2 Feb 2003 20:29:59 -0000 @@ -941,11 +964,7 @@ if(MSVCRT___mb_cur_max > 1) { char *res = dst; - while (*dst) - { - if (MSVCRT_isleadbyte(*dst++)) - dst++; - } + while (*dst++); while (*src && len--) { *dst++ = *src;
Attachment:
pgp00101.pgp
Description: PGP signature