[sr-dev] git:master:6416d394: core: fix xavp_serialize_fields

Julien Chavanton jchavanton at gmail.com
Thu Sep 19 10:11:18 CEST 2019


Module: kamailio
Branch: master
Commit: 6416d394ae4fcb07726a19686dbc4c3f2e0116c5
URL: https://github.com/kamailio/kamailio/commit/6416d394ae4fcb07726a19686dbc4c3f2e0116c5

Author: Julien Chavanton <jchavanton at gmail.com>
Committer: Julien Chavanton <jchavanton at gmail.com>
Date: 2019-09-18T10:57:35-07:00

core: fix xavp_serialize_fields

stop adding plus signs when serializing empty strings

github issue #2067

---

Modified: src/core/xavp.c

---

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

---

diff --git a/src/core/xavp.c b/src/core/xavp.c
index b3a2654764..e5e33f6e9d 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -1030,9 +1030,14 @@ int xavp_serialize_fields(str *rname, char *obuf, int olen)
 			break;
 			case SR_XTYPE_STR:
 				LM_DBG("     XAVP str value: %s\n", avp->val.v.s.s);
-				ostr.len = snprintf(ostr.s, olen-rlen, "%.*s=%.*s;",
+				if(avp->val.v.s.len == 0) {
+					ostr.len = snprintf(ostr.s, olen-rlen, "%.*s;",
+						avp->name.len, avp->name.s);
+				} else {
+					ostr.len = snprintf(ostr.s, olen-rlen, "%.*s=%.*s;",
 						avp->name.len, avp->name.s,
 						avp->val.v.s.len, avp->val.v.s.s);
+				}
 				if(ostr.len<=0 || ostr.len>=olen-rlen) {
 					LM_ERR("failed to serialize int value (%d/%d\n",
 							ostr.len, olen-rlen);




More information about the sr-dev mailing list