diff options
author | normal <normal@ruby-lang.org> | 2016-08-06 21:50:10 +0000 |
---|---|---|
committer | normal <normal@ruby-lang.org> | 2016-08-06 21:50:10 +0000 |
commit | f8316bff03aa6c510ac801b4367bab74a3b7c2c5 (patch) | |
tree | 75c2979c72e61e72cb00a49f217731221465684f /test/test_x509req.rb | |
parent | f3afe3b1299c57ac723af59ba6208ec1f94abf57 (diff) | |
download | ruby-openssl-history-f8316bff03aa6c510ac801b4367bab74a3b7c2c5.tar.gz |
openssl: avoid undefined behavior on empty SSL_write
SSL_write(3ssl) manpage has this in the WARNINGS section:
When calling SSL_write() with num=0 bytes to be sent the
behaviour is undefined.
And indeed, the new test case demonstrates failures when
empty strings are used. So, match the behavior of IO#write,
IO#write_nonblock, and IO#syswrite by returning zero, as the
OpenSSL::SSL::SSLSocket API already closely mimics the IO one.
* ext/openssl/ossl_ssl.c (ossl_ssl_write_internal):
avoid undefined behavior
* test/openssl/test_pair.rb (test_write_zero): new test
[ruby-core:76751] [Bug #12660]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_x509req.rb')
0 files changed, 0 insertions, 0 deletions