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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-06-23T08:58:50+02:00

crypto: check returned environment for nio events

---

Modified: src/modules/crypto/crypto_evcb.c

---

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

---

diff --git a/src/modules/crypto/crypto_evcb.c b/src/modules/crypto/crypto_evcb.c
index 0bf0a25d5d2..a75eeef2e66 100644
--- a/src/modules/crypto/crypto_evcb.c
+++ b/src/modules/crypto/crypto_evcb.c
@@ -310,6 +310,10 @@ int crypto_nio_in(sip_msg_t *msg)
        crypto_env_t *evenv;
 
        evenv = crypto_get_msg_env(msg);
+       if(evenv == NULL) {
+               LM_ERR("crypto netio environment not available\n");
+               return -1;
+       }
        if(evenv->mflags & CRYPTO_NIO_OUT) {
                return -1;
        }
@@ -325,6 +329,10 @@ int crypto_nio_out(sip_msg_t *msg)
        crypto_env_t *evenv;
 
        evenv = crypto_get_msg_env(msg);
+       if(evenv == NULL) {
+               LM_ERR("crypto netio environment not available\n");
+               return -1;
+       }
        if(evenv->mflags & CRYPTO_NIO_OUT) {
                return 1;
        }
@@ -340,6 +348,10 @@ int crypto_nio_encrypt(sip_msg_t *msg)
        crypto_env_t *evenv;
 
        evenv = crypto_get_msg_env(msg);
+       if(evenv == NULL) {
+               LM_ERR("crypto netio environment not available\n");
+               return -1;
+       }
 
        evenv->mflags |= CRYPTO_NIO_ENCRYPT;
 
@@ -354,6 +366,10 @@ int crypto_nio_decrypt(sip_msg_t *msg)
        crypto_env_t *evenv;
 
        evenv = crypto_get_msg_env(msg);
+       if(evenv == NULL) {
+               LM_ERR("crypto netio environment not available\n");
+               return -1;
+       }
 
        evenv->mflags |= CRYPTO_NIO_DECRYPT;
 

_______________________________________________
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