mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
Handle overlapping buffers properly in wcstombs_sbcs (spotted by
Dmitry Timoshkov).
This commit is contained in:
parent
34a148685e
commit
794b130cbb
1 changed files with 11 additions and 0 deletions
|
@ -143,6 +143,17 @@ static inline int wcstombs_sbcs( const struct sbcs_table *table,
|
|||
ret = -1;
|
||||
}
|
||||
|
||||
if (dst <= (char *)src && dst + 16 > (char *)src)
|
||||
{
|
||||
/* overlapping buffers, do it char by char */
|
||||
while (srclen--)
|
||||
{
|
||||
*dst++ = uni2cp_low[uni2cp_high[*src >> 8] + (*src & 0xff)];
|
||||
src++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
switch(srclen)
|
||||
|
|
Loading…
Reference in a new issue