Improve calculation of base64 encode buffer length.
The previous formula miscalculates the size of the resultant buffer and will overflow when len is large. For example, when len = INT_MAX, needed = 2. The revised formula correctly computes the space requirements for the entire int domain. Returning to the example, needed = 2863311533 is corrected computed.