Module: kamailio
Branch: master
Commit: c9916b1f8bacabecd48040b7635c12783b1c875d
URL: 
https://github.com/kamailio/kamailio/commit/c9916b1f8bacabecd48040b7635c12783b1c875d

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-06-22T17:29:11+02:00

crypto: check size for iv prefix in aes decrypt helper

---

Modified: src/modules/crypto/crypto_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/c9916b1f8bacabecd48040b7635c12783b1c875d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/c9916b1f8bacabecd48040b7635c12783b1c875d.patch

---

diff --git a/src/modules/crypto/crypto_mod.c b/src/modules/crypto/crypto_mod.c
index a079987a9ff..985501b2c1c 100644
--- a/src/modules/crypto/crypto_mod.c
+++ b/src/modules/crypto/crypto_mod.c
@@ -496,6 +496,12 @@ static int ki_crypto_aes_decrypt_helper(
                }
                lkey.s = (char *)decoded_key;
                /* IV is prefix of cipher text, 128 bits for AES */
+               if(etext.len < 16) {
+                       LM_ERR("decoded ciphertext is too short for IV prefix: 
%d\n",
+                                       etext.len);
+                       EVP_CIPHER_CTX_free(de);
+                       return -1;
+               }
                iv = etext.s;
                etext.s += 16;
                etext.len -= 16;

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to