# Gavin Andresen
# 2010-07-25 21:38:19
# https://bitcointalk.org/index.php?topic=461.msg5768#msg5768

@s{quotedtext}
@s{quotedtext}
 @p{brk}
Great catch!  Simpler fix is to specify the BIO_FLAGS_BASE64_NO_NL in the rpc.cpp/EncodeBase64 function: @p{brk}

Code:
diff @p{--}git a/rpc.cpp b/rpc.cpp @p{brk}
index 72bdc50..703b757 100644 @p{brk}
@p{@p{--}-} a/rpc.cpp @p{brk}
+++ b/rpc.cpp @p{brk}
@@ -765,13 +765,14 @@ string EncodeBase64(string s) @p{brk}
     BUF_MEM *bptr; @p{par}

     b64 = BIO_new(BIO_f_base64()); @p{brk}
+    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); @p{brk}
     bmem = BIO_new(BIO_s_mem()); @p{brk}
     b64 = BIO_push(b64, bmem); @p{brk}
     BIO_write(b64, s.c_str(), s.size()); @p{brk}
     BIO_flush(b64); @p{brk}
     BIO_get_mem_ptr(b64, &bptr); @p{par}

-    string result(bptr-@s{gt}data, bptr-@s{gt}length-1); @p{brk}
+    string result(bptr-@s{gt}data, bptr-@s{gt}length); @p{brk}
     BIO_free_all(b64); @p{par}

     return result; @p{brk}