Note about strnlen on OS X.
Use strnlen.