added a fix to include an implementation of strnlen for mac since it isn't provided on versions < 10.6