make sure we have enough space for the encrypted and encoded version of the junk

This commit is contained in:
Hubert Chathi 2021-11-17 14:18:03 -05:00
parent 06b723db6e
commit 609e7e8d40
3 changed files with 5 additions and 5 deletions

View file

@ -55,7 +55,7 @@ int main() {
/* Deliberately corrupt the pickled session by supplying a junk suffix and
* ensure this is caught as an error. */
const size_t junk_length = 1;
std::vector<std::uint8_t> junk_pickle(pickle_length + junk_length);
std::vector<std::uint8_t> junk_pickle(pickle_length + _olm_enc_output_length(junk_length));
olm_pickle_outbound_group_session(
session, "secret_key", 10, junk_pickle.data(), pickle_length
@ -110,7 +110,7 @@ int main() {
/* Deliberately corrupt the pickled session by supplying a junk suffix and
* ensure this is caught as an error. */
const size_t junk_length = 1;
std::vector<std::uint8_t> junk_pickle(pickle_length + junk_length);
std::vector<std::uint8_t> junk_pickle(pickle_length + _olm_enc_output_length(junk_length));
olm_pickle_inbound_group_session(
session, "secret_key", 10, junk_pickle.data(), pickle_length

View file

@ -71,7 +71,7 @@ assert_equals(pickle1.data(), pickle2.data(), pickle_length);
/* Deliberately corrupt the pickled account by supplying a junk suffix and
* ensure this is caught as an error. */
const size_t junk_length = 1;
std::vector<std::uint8_t> junk_pickle(pickle_length + junk_length);
std::vector<std::uint8_t> junk_pickle(pickle_length + _olm_enc_output_length(junk_length));
res = ::olm_pickle_account(
account, "secret_key", 10, junk_pickle.data(), pickle_length);
@ -162,7 +162,7 @@ assert_equals(pickle1.data(), pickle2.data(), pickle_length);
/* Deliberately corrupt the pickled session by supplying a junk suffix and
* ensure this is caught as an error. */
const size_t junk_length = 1;
std::vector<std::uint8_t> junk_pickle(pickle_length + junk_length);
std::vector<std::uint8_t> junk_pickle(pickle_length + _olm_enc_output_length(junk_length));
res = ::olm_pickle_session(
session, "secret_key", 10, junk_pickle.data(), pickle_length);

View file

@ -146,7 +146,7 @@ assert_equals(alice_public, pubkey.data(), olm_pk_key_length());
* ensure this is caught as an error. */
const size_t junk_length = 1;
std::size_t pickle_length = olm_pickle_pk_decryption_length(decryption);
std::vector<std::uint8_t> junk_pickle(pickle_length + junk_length);
std::vector<std::uint8_t> junk_pickle(pickle_length + _olm_enc_output_length(junk_length));
olm_pickle_pk_decryption(
decryption,