Module: kamailio
Branch: master
Commit: 79a668b8bdb0e085adb3581d718e5fd5ae73e2e4
URL:
https://github.com/kamailio/kamailio/commit/79a668b8bdb0e085adb3581d718e5fd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-07-22T10:41:47+02:00
tls: check lenght when parsing pv alt name
---
Modified: src/modules/tls/tls_select.c
---
Diff:
https://github.com/kamailio/kamailio/commit/79a668b8bdb0e085adb3581d718e5fd…
Patch:
https://github.com/kamailio/kamailio/commit/79a668b8bdb0e085adb3581d718e5fd…
---
diff --git a/src/modules/tls/tls_select.c b/src/modules/tls/tls_select.c
index c788eabcd63..8b1a0457c0a 100644
--- a/src/modules/tls/tls_select.c
+++ b/src/modules/tls/tls_select.c
@@ -1190,13 +1190,13 @@ int pv_parse_alt_name(pv_spec_p sp, str *in)
if(in->s == NULL || in->len <= 0)
return -1;
- if(strncmp(in->s, "DNS", 3) == 0) {
+ if(in->len == 3 && strncmp(in->s, "DNS", 3) == 0) {
sp->pvp.pvn.u.isname.name.n = PV_COMP_HOST;
- } else if(strncmp(in->s, "URI", 3) == 0) {
+ } else if(in->len == 3 && strncmp(in->s, "URI", 3) == 0) {
sp->pvp.pvn.u.isname.name.n = PV_COMP_URI;
- } else if(strncmp(in->s, "EMAIL", 5) == 0) {
+ } else if(in->len == 5 && strncmp(in->s, "EMAIL", 5) == 0) {
sp->pvp.pvn.u.isname.name.n = PV_COMP_E;
- } else if(strncmp(in->s, "IP", 2) == 0) {
+ } else if(in->len == 2 && strncmp(in->s, "IP", 2) == 0) {
sp->pvp.pvn.u.isname.name.n = PV_COMP_IP;
} else {
LM_ERR("Unsupported alt name %s\n", in->s);