Correct handling of non-NUL terminated buffers after last commit.

strlen() or wcslen() can't be used with possibly non-NUL-terminated strings,
so use [our own equivalents of] strnlen() and wcsnlen() instead.

This required adding yet another parameter to string typemap macros, so update
the example using them accordingly too.