Module: kamailio
Branch: master
Commit: 0e0bdbf83c7f20bf1814fb58232f8c25e29dd94d
URL:
https://github.com/kamailio/kamailio/commit/0e0bdbf83c7f20bf1814fb58232f8c2…
Author: Kristiyan Peychev <kristiyan.peychev(a)flolive.net>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-03-11T10:27:56+01:00
ims_registrar_scscf: use xmlParseMemory instead of xmlParseDoc
Fix issues where a non-zero terminated string would get passed to `parse_user_data`.
---
Modified: src/modules/ims_registrar_scscf/userdata_parser.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0e0bdbf83c7f20bf1814fb58232f8c2…
Patch:
https://github.com/kamailio/kamailio/commit/0e0bdbf83c7f20bf1814fb58232f8c2…
---
diff --git a/src/modules/ims_registrar_scscf/userdata_parser.c
b/src/modules/ims_registrar_scscf/userdata_parser.c
index 4880f0289c..d8b08b5491 100644
--- a/src/modules/ims_registrar_scscf/userdata_parser.c
+++ b/src/modules/ims_registrar_scscf/userdata_parser.c
@@ -916,7 +916,7 @@ static ims_subscription* parse_ims_subscription(xmlDocPtr doc,
xmlNodePtr root)
/**
* Parses the user data XML and copies data into a new ims_subscription structure.
- * @param xml - the input xml (NB must be null terminated)
+ * @param xml - the input xml
* @returns the ims_subscription* on success or NULL on error
*/
ims_subscription *parse_user_data(str xml)
@@ -927,7 +927,7 @@ ims_subscription *parse_user_data(str xml)
if (!ctxtInit) parser_init(scscf_user_data_dtd,scscf_user_data_xsd);
doc=0;
- doc = xmlParseDoc((unsigned char *)xml.s);
+ doc = xmlParseMemory((unsigned char *)xml.s, xml.len);
if (!doc){
LM_ERR("This is not a valid XML <%.*s>\n", xml.len,xml.s);
goto error;