strnlen isn't available on some platforms, use StringRef instead