Avoid memrchr() as it's not available on OS X.