Module: kamailio
Branch: 6.1
Commit: 4960e787fe95fa52c07b959af157232bfc1697fa
URL: 
https://github.com/kamailio/kamailio/commit/4960e787fe95fa52c07b959af157232bfc1697fa

Author: Alexey Volokitin <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-02-25T21:24:59+01:00

outbound: parse Expires header to prevent crash

(cherry picked from commit bf135ccbdcf2bdb607c95952c92bd96972e65413)

---

Modified: src/modules/outbound/outbound_mod.c

---

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

---

diff --git a/src/modules/outbound/outbound_mod.c 
b/src/modules/outbound/outbound_mod.c
index 9ea01281600..eff39c55cc5 100644
--- a/src/modules/outbound/outbound_mod.c
+++ b/src/modules/outbound/outbound_mod.c
@@ -342,11 +342,21 @@ static int use_outbound_register(struct sip_msg *msg)
                        return 0;
                }
 
-               if(((contact_body_t *)msg->contact->parsed)->star
-                               && ((exp_body_t *)msg->expires->parsed)->val == 
0) {
-                       LM_DBG("found REGISTER with * in Contact: header body 
and Expires "
-                                  ": 0 - outbound used\n");
-                       return 1;
+               if(((contact_body_t *)msg->contact->parsed)->star) {
+                       if(!msg->expires) {
+                               LM_ERR("absent Expires header\n");
+                               return 0;
+                       }
+                       if(!msg->expires->parsed && parse_expires(msg->expires) 
< 0) {
+                               LM_ERR("parsing Expires: header body\n");
+                               return 0;
+                       }
+                       if(((exp_body_t *)msg->expires->parsed)->val == 0) {
+                               LM_DBG("found REGISTER with * in Contact: 
header body and "
+                                          "Expires "
+                                          ": 0 - outbound used\n");
+                               return 1;
+                       }
                }
 
                contact = ((contact_body_t *)msg->contact->parsed)->contacts;

_______________________________________________
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