Browse code

core: fix xavp_serialize_fields

stop adding plus signs when serializing empty strings

github issue #2067

Julien Chavanton authored on 18/09/2019 17:57:35
Showing 1 changed files
... ...
@@ -1030,9 +1030,14 @@ int xavp_serialize_fields(str *rname, char *obuf, int olen)
1030 1030
 			break;
1031 1031
 			case SR_XTYPE_STR:
1032 1032
 				LM_DBG("     XAVP str value: %s\n", avp->val.v.s.s);
1033
-				ostr.len = snprintf(ostr.s, olen-rlen, "%.*s=%.*s;",
1033
+				if(avp->val.v.s.len == 0) {
1034
+					ostr.len = snprintf(ostr.s, olen-rlen, "%.*s;",
1035
+						avp->name.len, avp->name.s);
1036
+				} else {
1037
+					ostr.len = snprintf(ostr.s, olen-rlen, "%.*s=%.*s;",
1034 1038
 						avp->name.len, avp->name.s,
1035 1039
 						avp->val.v.s.len, avp->val.v.s.s);
1040
+				}
1036 1041
 				if(ostr.len<=0 || ostr.len>=olen-rlen) {
1037 1042
 					LM_ERR("failed to serialize int value (%d/%d\n",
1038 1043
 							ostr.len, olen-rlen);