Not all platforms have support for strnlen (e.g. cygwin) as this is a non-standard function. This patch provides a custom implementation of strnlen for these platforms.