Module: kamailio
Branch: master
Commit: 2c425c16efdc70e76d7471156f9f2c6eefa4b001
URL:
https://github.com/kamailio/kamailio/commit/2c425c16efdc70e76d7471156f9f2c6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-14T09:59:58+02:00
drouting: extra safety checks for str pointers
---
Modified: modules/drouting/drouting.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2c425c16efdc70e76d7471156f9f2c6…
Patch:
https://github.com/kamailio/kamailio/commit/2c425c16efdc70e76d7471156f9f2c6…
---
diff --git a/modules/drouting/drouting.c b/modules/drouting/drouting.c
index 1c94fe3..3c79f26 100644
--- a/modules/drouting/drouting.c
+++ b/modules/drouting/drouting.c
@@ -563,7 +563,7 @@ static inline str* build_ruri(struct sip_uri *uri, int strip, str
*pri,
}
memcpy(p, uri->user.s+strip, uri->user.len-strip);
p += uri->user.len-strip;
- if (uri->passwd.len) {
+ if (uri->passwd.s && uri->passwd.len) {
*(p++)=':';
memcpy(p, uri->passwd.s, uri->passwd.len);
p += uri->passwd.len;
@@ -571,12 +571,12 @@ static inline str* build_ruri(struct sip_uri *uri, int strip, str
*pri,
*(p++)='@';
memcpy(p, hostport->s, hostport->len);
p += hostport->len;
- if (uri->params.len) {
+ if (uri->params.s && uri->params.len) {
*(p++)=';';
memcpy(p, uri->params.s, uri->params.len);
p += uri->params.len;
}
- if (uri->headers.len) {
+ if (uri->headers.s && uri->headers.len) {
*(p++)='?';
memcpy(p, uri->headers.s, uri->headers.len);
p += uri->headers.len;