This is could be a bug if the len is greater than INT64_MAX, but the code doesn't seem to care about this, so adding the explicit cast to remove the compiler warning.