Module: kamailio
Branch: master
Commit: dbf9b28402d9506c5761476febc31fbf45eb08fa
URL:
https://github.com/kamailio/kamailio/commit/dbf9b28402d9506c5761476febc31fb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-04-22T12:29:35+02:00
ims_diameter_server: 0-terminate value converted to json
---
Modified: src/modules/ims_diameter_server/avp_helper.c
---
Diff:
https://github.com/kamailio/kamailio/commit/dbf9b28402d9506c5761476febc31fb…
Patch:
https://github.com/kamailio/kamailio/commit/dbf9b28402d9506c5761476febc31fb…
---
diff --git a/src/modules/ims_diameter_server/avp_helper.c
b/src/modules/ims_diameter_server/avp_helper.c
index 04e2d6d967..73c0e047ea 100644
--- a/src/modules/ims_diameter_server/avp_helper.c
+++ b/src/modules/ims_diameter_server/avp_helper.c
@@ -164,9 +164,10 @@ int AAAmsg2json(AAAMessage * request, str * dest) {
}
dest->len = strlen(out);
- dest->s = pkg_malloc(dest->len);
+ dest->s = pkg_malloc(dest->len + 1);
if (dest->s) {
memcpy(dest->s, out, dest->len);
+ dest->s[dest->len] = '\0';
free(out);
} else {
LM_WARN("Failed to allocate %d bytes for the JSON\n", dest->len);