Fix extra bytes in err message
authorSubodh Iyengar <subodh@fb.com>
Fri, 13 May 2016 07:24:05 +0000 (00:24 -0700)
committerFacebook Github Bot 8 <facebook-github-bot-8-bot@fb.com>
Fri, 13 May 2016 07:38:37 +0000 (00:38 -0700)
commit2b6dd2e579a34c1a50214f0ae0aa7e61135d657d
treeb061f8eda420ebe14cc0fbb0ac82af2afca163e4
parentaf8129a20218967099a90fc419762f3770574377
Fix extra bytes in err message

Summary:
Error message might be < 256 bytes
in which case buf.size() would be greater
than the size of the message written out
and we might have garbled bytes at the end.

ERR_error_string_n null terminates the string
so just use that.

Reviewed By: anirudhvr

Differential Revision: D3297320

fbshipit-source-id: 2ae626ce4c49ca478806c0bcc40a390e5a84f24b
folly/io/async/ssl/SSLErrors.cpp
folly/io/async/ssl/test/SSLErrorsTest.cpp [new file with mode: 0644]