Module: kamailio
Branch: master
Commit: 97855a1766edf4ecc2cc4e38f3cc0d3cea3190db
URL: 
https://github.com/kamailio/kamailio/commit/97855a1766edf4ecc2cc4e38f3cc0d3cea3190db

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2018-10-19T11:34:08+02:00

core: cfg select - safety check accessing vars before initialization

---

Modified: src/core/cfg/cfg_select.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/97855a1766edf4ecc2cc4e38f3cc0d3cea3190db.diff
Patch: 
https://github.com/kamailio/kamailio/commit/97855a1766edf4ecc2cc4e38f3cc0d3cea3190db.patch

---

diff --git a/src/core/cfg/cfg_select.c b/src/core/cfg/cfg_select.c
index b8b5d265a0..175c6bd589 100644
--- a/src/core/cfg/cfg_select.c
+++ b/src/core/cfg/cfg_select.c
@@ -220,7 +220,12 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg 
*msg)
                        break;
 
                case CFG_VAR_STR:
-                       memcpy(res, p, sizeof(str));
+                       if(p) {
+                               memcpy(res, p, sizeof(str));
+                       } else {
+                               res->s = 0;
+                               res->len = 0;
+                       }
                        break;
 
                default:


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to