diff options
author | Marvin W <git@larma.de> | 2018-01-04 21:06:20 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2018-01-04 21:06:20 +0100 |
commit | 6b58b348fa42c3206f56c4b897a255d81f0ea7a9 (patch) | |
tree | 194796e73f1f423a77463f0afc203059bf045b23 | |
parent | b482c57f3b5d78d853dfa4da51e274fc0b09dbb7 (diff) | |
download | dino-6b58b348fa42c3206f56c4b897a255d81f0ea7a9.tar.gz dino-6b58b348fa42c3206f56c4b897a255d81f0ea7a9.zip |
Small fixes to signal-protocol-c helper functions
ref #253
-rw-r--r-- | plugins/signal-protocol/src/signal_helper.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/signal-protocol/src/signal_helper.c b/plugins/signal-protocol/src/signal_helper.c index 21935181..7de934e9 100644 --- a/plugins/signal-protocol/src/signal_helper.c +++ b/plugins/signal-protocol/src/signal_helper.c @@ -281,6 +281,7 @@ int signal_vala_decrypt(signal_buffer **output, void *user_data) { int algo, mode; if (aes_cipher(cipher, key_len, &algo, &mode)) return SG_ERR_UNKNOWN; + if (ciphertext_len == 0) return SG_ERR_UNKNOWN; if (iv_len != 16) return SG_ERR_UNKNOWN; @@ -325,7 +326,7 @@ no_error: if (pkcs_pad) { uint8_t pad_len = out_buf[padded_len - 1]; - if (pad_len > 16) goto error; + if (pad_len > 16 || pad_len > padded_len) goto error; *output = signal_buffer_create(out_buf, padded_len - pad_len); } else { *output = signal_buffer_create(out_buf, padded_len); |