[Python-modules-commits] [python-cryptography] 01/03: Actually allocate a buffer that is the correct size.

Tristan Seligmann mithrandi at moszumanska.debian.org
Mon Feb 8 18:47:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

mithrandi pushed a commit to branch master
in repository python-cryptography.

commit e441791b8d152729ac02814168038a3c40b81a10
Author: Tristan Seligmann <mithrandi at mithrandi.net>
Date:   Mon Feb 8 15:12:48 2016 +0200

    Actually allocate a buffer that is the correct size.
---
 tests/hazmat/backends/test_openssl.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index e055568..0b55a48 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -611,10 +611,11 @@ class TestOpenSSLSerializationWithOpenSSL(object):
 
     def test_pem_password_cb(self):
         password = b'abcdefg'
+        buf_size = len(password) + 1
         ffi_cb, userdata = backend._pem_password_cb(password)
         handle = backend._ffi.new_handle(userdata)
-        buf = backend._ffi.new('char *')
-        assert ffi_cb(buf, len(password) + 1, False, handle) == len(password)
+        buf = backend._ffi.new('char[]', buf_size)
+        assert ffi_cb(buf, buf_size, False, handle) == len(password)
         assert userdata.called == 1
         assert backend._ffi.string(buf, len(password)) == password
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-cryptography.git



More information about the Python-modules-commits mailing list