Module: kamailio
Branch: master
Commit: 7350a80a1d4d121a75e12529553191c4a9038f56
URL:
https://github.com/kamailio/kamailio/commit/7350a80a1d4d121a75e12529553191c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/7350a80a1d4d121a75e12529553191c…
Patch:
https://github.com/kamailio/kamailio/commit/7350a80a1d4d121a75e12529553191c…
---
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) {