Module: kamailio
Branch: master
Commit: 6ee26a3ae3293aaeb4507d5d0b16ad31173cc39a
URL:
https://github.com/kamailio/kamailio/commit/6ee26a3ae3293aaeb4507d5d0b16ad3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-04T08:57:47+01:00
core: parser rr - check for rr value before serializing
---
Modified: src/core/parser/parse_rr.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6ee26a3ae3293aaeb4507d5d0b16ad3…
Patch:
https://github.com/kamailio/kamailio/commit/6ee26a3ae3293aaeb4507d5d0b16ad3…
---
diff --git a/src/core/parser/parse_rr.c b/src/core/parser/parse_rr.c
index f6fce793faf..362f30b15ed 100644
--- a/src/core/parser/parse_rr.c
+++ b/src/core/parser/parse_rr.c
@@ -444,20 +444,28 @@ int print_rr_body(
i = (nb_recs == NULL) ? 0 : *nb_recs;
while(i < n) {
- memcpy(cp, route[i].s, route[i].len);
- cp += route[i].len;
- if(++i < n)
- *(cp++) = ',';
+ if(route[i].s != NULL) {
+ memcpy(cp, route[i].s, route[i].len);
+ cp += route[i].len;
+ if(++i < n)
+ *(cp++) = ',';
+ } else {
+ i++;
+ }
}
} else {
i = (nb_recs == NULL) ? n - 1 : (n - *nb_recs - 1);
while(i >= 0) {
- memcpy(cp, route[i].s, route[i].len);
- cp += route[i].len;
- if(i-- > 0)
- *(cp++) = ',';
+ if(route[i].s != NULL) {
+ memcpy(cp, route[i].s, route[i].len);
+ cp += route[i].len;
+ if(i-- > 0)
+ *(cp++) = ',';
+ } else {
+ i--;
+ }
}
}
oroute->len = cp - start;