diff options
author | Jack Lloyd <[email protected]> | 2015-09-10 01:57:42 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-09-10 01:57:42 -0400 |
commit | 53082a739c78d50fd54422ac1b8a34f742890b10 (patch) | |
tree | 9cdb8ccb5d9183303b1024dc4ab2fde9f5f11ad7 /src | |
parent | a96a7b79662f5045f0810dfa5d5cb4ebbd04ae42 (diff) |
Reduce likelyhood of stray pointer writes via ffi layer.
In error cases the output value was not intialized, so callers which
ignored the error return might blindly use an uninitialized pointer.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ffi/ffi.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp index 8d96a0fc7..625b1947b 100644 --- a/src/lib/ffi/ffi.cpp +++ b/src/lib/ffi/ffi.cpp @@ -912,6 +912,8 @@ int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op, { BOTAN_ASSERT_NONNULL(op); + *op = nullptr; + if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; @@ -955,6 +957,8 @@ int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op, { BOTAN_ASSERT_NONNULL(op); + *op = nullptr; + if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; @@ -997,6 +1001,8 @@ int botan_pk_op_sign_create(botan_pk_op_sign_t* op, { BOTAN_ASSERT_NONNULL(op); + *op = nullptr; + if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; @@ -1086,6 +1092,8 @@ int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op, { BOTAN_ASSERT_NONNULL(op); + *op = nullptr; + if(flags != 0) return BOTAN_FFI_ERROR_BAD_FLAG; |