Use our strnlen on MacOS for backward compat

Apparently MacOS didn't have `strnlen` on 10.6 and earlier.  To avoid having linking problems on older versions, we'll just use our internal version. Fixes #2009