fixed bug in strchrnul for mac (causing overflows)