Module: kamailio
Branch: master
Commit: 17a2eec2a8e47939782c1352ddb0fa4d3e73f9d8
URL:
https://github.com/kamailio/kamailio/commit/17a2eec2a8e47939782c1352ddb0fa4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-09-09T09:05:54+02:00
core: parse_to_param() check for end of data on escape or start of value
---
Modified: src/core/parser/parse_addr_spec.c
---
Diff:
https://github.com/kamailio/kamailio/commit/17a2eec2a8e47939782c1352ddb0fa4…
Patch:
https://github.com/kamailio/kamailio/commit/17a2eec2a8e47939782c1352ddb0fa4…
---
diff --git a/src/core/parser/parse_addr_spec.c b/src/core/parser/parse_addr_spec.c
index 0b8cddc8e2..99138dcaf4 100644
--- a/src/core/parser/parse_addr_spec.c
+++ b/src/core/parser/parse_addr_spec.c
@@ -225,6 +225,12 @@ static char *parse_to_param(char *const buffer, const char *const
end,
case '\\':
switch(status) {
case PARA_VALUE_QUOTED:
+ if(tmp+1>=end) {
+ LM_ERR("unexpected end of data in status %d - start: %p"
+ " - end: %p - crt: %p\n",
+ status, buffer, end , tmp);
+ goto error;
+ }
switch(*(tmp + 1)) {
case '\r':
case '\n':
@@ -241,6 +247,12 @@ static char *parse_to_param(char *const buffer, const char *const
end,
case '"':
switch(status) {
case S_PARA_VALUE:
+ if(tmp+1>=end) {
+ LM_ERR("unexpected end of data in status %d - start: %p"
+ " - end: %p - crt: %p\n",
+ status, buffer, end , tmp);
+ goto error;
+ }
param->value.s = tmp + 1;
status = PARA_VALUE_QUOTED;
break;