Module: kamailio
Branch: 6.0
Commit: ec76d674e688c20255322e6b77e2f0e823960e6d
URL: 
https://github.com/kamailio/kamailio/commit/ec76d674e688c20255322e6b77e2f0e823960e6d

Author: Richard Fuchs <[email protected]>
Committer: Richard Fuchs <[email protected]>
Date: 2025-08-08T07:41:29-04:00

rtpengine: enlarge cookie buffer

With `server_id` being a signed int, it may be negative, taking up 11
characters instead of 10.

Add explicit type casts to ensure future consistency.

Closes #4350

(cherry picked from commit 6281f71476dfd1f71c824029b1970100cc150d7d)

---

Modified: src/modules/rtpengine/rtpengine.c

---

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

---

diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index eda513c978e..3db1b82064f 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -2851,9 +2851,10 @@ static void mod_destroy(void)
 
 static char *gencookie(void)
 {
-       static char cook[34];
+       static char cook[35]; // 11 + 1 + 10 + 1 + 10 + 1 + 1
 
-       snprintf(cook, 34, "%d_%u_%u ", server_id, fastrand(), myseqn);
+       snprintf(cook, 35, "%" PRId32 "_%" PRIu32 "_%" PRIu32 " ",
+                       (int32_t) server_id, (uint32_t) fastrand(), (uint32_t) 
myseqn);
        myseqn++;
        return cook;
 }

_______________________________________________
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