diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-02-08 11:50:52 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-02-08 11:50:52 -0600 |
commit | a0bef9dfde0e94bd1a01db1b4fa51632ac842ee7 (patch) | |
tree | d3bdc80fd267a6d082ccb1e6d094c158f02e62a2 /tests | |
parent | 0c741a55b28b84afad3c09f6e36d563b12070e3e (diff) | |
parent | 9882a4e3ea07aa0ab9ef45484d0ce853f4e1c139 (diff) | |
download | cryptography-a0bef9dfde0e94bd1a01db1b4fa51632ac842ee7.tar.gz cryptography-a0bef9dfde0e94bd1a01db1b4fa51632ac842ee7.tar.bz2 cryptography-a0bef9dfde0e94bd1a01db1b4fa51632ac842ee7.zip |
Merge pull request #2718 from mithrandi/bogus-test-allocation-2711
Actually allocate a buffer that is the correct size.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index e0555686..0b55a485 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 |