Module: kamailio
Branch: master
Commit: d3acf9cc56f0ee73bee3c7cf1210c052d79a4c46
URL:
https://github.com/kamailio/kamailio/commit/d3acf9cc56f0ee73bee3c7cf1210c05…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-09-11T14:25:47+02:00
core: parser - handle comma inside quoted params of via
---
Modified: src/core/parser/parse_via.c
Modified: src/core/parser/parse_via.h
---
Diff:
https://github.com/kamailio/kamailio/commit/d3acf9cc56f0ee73bee3c7cf1210c05…
Patch:
https://github.com/kamailio/kamailio/commit/d3acf9cc56f0ee73bee3c7cf1210c05…
---
diff --git a/src/core/parser/parse_via.c b/src/core/parser/parse_via.c
index a978d1aaf2e..c604f55aa2e 100644
--- a/src/core/parser/parse_via.c
+++ b/src/core/parser/parse_via.c
@@ -1162,10 +1162,18 @@ static /*inline*/ char *parse_via_param(char *const p, const char
*const end,
case ',':
switch(state) {
case P_VALUE:
+ if(param->flags & VIA_PARAM_F_QUOTED) {
+ /* inside a quoted value */
+ break;
+ }
param->value.len = tmp - param->value.s;
state = F_VIA;
goto endofvalue;
case P_STRING:
+ if(param->flags & VIA_PARAM_F_QUOTED) {
+ /* inside a quoted value */
+ break;
+ }
case F_LF:
case F_CR:
case F_CRLF:
@@ -1217,6 +1225,7 @@ static /*inline*/ char *parse_via_param(char *const p, const char
*const end,
case F_VALUE:
state = P_STRING;
param->value.s = tmp + 1;
+ param->flags |= VIA_PARAM_F_QUOTED;
break;
case P_STRING:
state = L_PARAM;
diff --git a/src/core/parser/parse_via.h b/src/core/parser/parse_via.h
index bd0a4ffbb14..d3de9737b68 100644
--- a/src/core/parser/parse_via.h
+++ b/src/core/parser/parse_via.h
@@ -53,9 +53,12 @@ enum
};
+#define VIA_PARAM_F_QUOTED (1)
+
typedef struct via_param
{
int type; /* Type of the parameter */
+ unsigned int flags; /* Flags for the parameter */
str name; /* Name of the parameter */
str value; /* Value of the parameter */
char *start; /* Pointer to param start, just after ';',