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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-07-22T14:44:42+02:00

nghttp2: duplicate reply status code in nghttp2_send_reply()

- expected to be freed later
- GH #3917

---

Modified: src/modules/nghttp2/nghttp2_mod.c

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_mod.c 
b/src/modules/nghttp2/nghttp2_mod.c
index a6b63b56e84..28b80544107 100644
--- a/src/modules/nghttp2/nghttp2_mod.c
+++ b/src/modules/nghttp2/nghttp2_mod.c
@@ -299,8 +299,14 @@ static int ksr_nghttp2_send_reply(sip_msg_t *msg, str 
*rcode, str *sbody)
        int rv;
        ssize_t writelen;
        int pipefd[2];
+       char *p;
 
-       _ksr_nghttp2_ctx.rplhdrs_v[0].value = (uint8_t *)rcode->s;
+       p = strndup(rcode->s, rcode->len);
+       if(p == NULL) {
+               SYS_MEM_ERROR;
+               return -1;
+       }
+       _ksr_nghttp2_ctx.rplhdrs_v[0].value = (uint8_t *)p;
        _ksr_nghttp2_ctx.rplhdrs_v[0].valuelen = rcode->len;
 
        if(_ksr_nghttp2_ctx.rplhdrs_n == 0) {

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to