Module: kamailio
Branch: master
Commit: b56110aca34a5633029654ae457ff3ed4424e62f
URL:
https://github.com/kamailio/kamailio/commit/b56110aca34a5633029654ae457ff3e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-08-29T17:18:35+02:00
usrloc: check for enough space to build aor on udomain_contact_expired_cb()
---
Modified: src/modules/usrloc/udomain.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b56110aca34a5633029654ae457ff3e…
Patch:
https://github.com/kamailio/kamailio/commit/b56110aca34a5633029654ae457ff3e…
---
diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c
index 578ae208aa4..43278fca004 100644
--- a/src/modules/usrloc/udomain.c
+++ b/src/modules/usrloc/udomain.c
@@ -1071,7 +1071,7 @@ int udomain_contact_expired_cb(db1_con_t *_c, udomain_t *_d)
continue;
}
user.len = strlen(user.s);
- if(user.len < AORBUF_SIZE) {
+ if(user.len + 1 < AORBUF_SIZE) {
memcpy(aorbuf, user.s, user.len);
aor.s = aorbuf;
aor.len = user.len;
@@ -1090,7 +1090,7 @@ int udomain_contact_expired_cb(db1_con_t *_c, udomain_t *_d)
if(ul_use_domain) {
domain.s = (char *)VAL_STRING(ROW_VALUES(row) + 20);
domain.len = strlen(domain.s);
- if(domain.len + aor.len < AORBUF_SIZE) {
+ if(domain.len + aor.len + 2 < AORBUF_SIZE) {
aorbuf[aor.len] = '@';
memcpy(aorbuf + aor.len + 1, domain.s, domain.len);
aor.len += domain.len + 1;