Module: kamailio
Branch: master
Commit: 084364becd2f6f5d6e620721cb0837466c3a2f31
URL:
https://github.com/kamailio/kamailio/commit/084364becd2f6f5d6e620721cb08374…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-12-08T16:50:51+01:00
tls: safety checks for select values
---
Modified: src/modules/tls/tls_select.c
---
Diff:
https://github.com/kamailio/kamailio/commit/084364becd2f6f5d6e620721cb08374…
Patch:
https://github.com/kamailio/kamailio/commit/084364becd2f6f5d6e620721cb08374…
---
diff --git a/src/modules/tls/tls_select.c b/src/modules/tls/tls_select.c
index c1c44c3763..ba765ff755 100644
--- a/src/modules/tls/tls_select.c
+++ b/src/modules/tls/tls_select.c
@@ -198,7 +198,11 @@ static int get_cipher(str* res, sip_msg_t* msg)
ERR("Cipher name too long\n");
goto err;
}
- memcpy(buf, cipher.s, cipher.len);
+ if(cipher.s!=NULL && cipher.len>0) {
+ memcpy(buf, cipher.s, cipher.len);
+ } else {
+ buf[0] = '\0';
+ }
res->s = buf;
res->len = cipher.len;
tcpconn_put(c);
@@ -298,7 +302,11 @@ static int get_version(str* res, sip_msg_t* msg)
ERR("Version string too long\n");
goto err;
}
- memcpy(buf, version.s, version.len);
+ if(version.s!=NULL && version.len>0) {
+ memcpy(buf, version.s, version.len);
+ } else {
+ buf[0] = '\0';
+ }
res->s = buf;
res->len = version.len;
tcpconn_put(c);