Fix implementation of wcsnlen and strnlen.