Document that EVP_EncodeBlock writes a trailing NUL.

Fix base64_test.c to account for this.

Change-Id: I0b3e8062a2130fb01a7e6f175968484769c406f9
Reviewed-on: https://boringssl-review.googlesource.com/1250
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/base64/base64_test.c b/crypto/base64/base64_test.c
index 992f13b..0cd2b6e 100644
--- a/crypto/base64/base64_test.c
+++ b/crypto/base64/base64_test.c
@@ -38,7 +38,7 @@
 static const size_t kNumTests = sizeof(test_vectors) / sizeof(test_vectors[0]);
 
 static int test_encode() {
-  uint8_t out[8];
+  uint8_t out[9];
   size_t i;
   ssize_t len;
 
diff --git a/include/openssl/base64.h b/include/openssl/base64.h
index c4d312c..52dfd6d 100644
--- a/include/openssl/base64.h
+++ b/include/openssl/base64.h
@@ -94,8 +94,9 @@
  * sets |*out_len| to the number of bytes written. */
 void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, uint8_t *out, int *out_len);
 
-/* EVP_EncodeBlock encodes |src_len| bytes from |src| and writes the result to
- * |dst|. It returns the number of bytes written. */
+/* EVP_EncodeBlock encodes |src_len| bytes from |src| and writes the
+ * result to |dst| with a trailing NUL. It returns the number of bytes
+ * written, not including this trailing NUL. */
 size_t EVP_EncodeBlock(uint8_t *dst, const uint8_t *src, size_t src_len);