Michael B Allen wrote:
> I was using an 'n' limit parameter of INT_MAX.
> Limiting this to 0xFFFF appears to solve the problem.

... but it is still wrong. The ISO C and POSIX specification of mbrtowc()
[http://www.opengroup.org/onlinepubs/007904975/functions/mbrtowc.html]
implies that the mbrtowc() function is free to look at 'n' bytes, starting
from the beginning of the string. In other words, the caller of the function
has to guarantee that 'n' bytes can be accessed. Passing blindly n = xFFFF
can crash your program.

Bruno

--
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/

Reply via email to