Module: kamailio
Branch: master
Commit: e50e3badc79776a6fa5ab225978df7bff14d26e7
URL:
https://github.com/kamailio/kamailio/commit/e50e3badc79776a6fa5ab225978df7b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-05-25T21:33:28+02:00
Merge pull request #638 from mslehto/NULL
Fix variable initialization and NULL pointer dereference issues
---
Modified: modules/call_control/call_control.c
Modified: modules/http_client/http_client.c
Modified: modules/mediaproxy/mediaproxy.c
Modified: modules/rr/record.c
Modified: modules/sipcapture/sipcapture.c
Modified: modules/uid_domain/uid_domain_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e50e3badc79776a6fa5ab225978df7b…
Patch:
https://github.com/kamailio/kamailio/commit/e50e3badc79776a6fa5ab225978df7b…
---
diff --git a/modules/call_control/call_control.c b/modules/call_control/call_control.c
index 62af924..5450e00 100644
--- a/modules/call_control/call_control.c
+++ b/modules/call_control/call_control.c
@@ -985,7 +985,7 @@ __dialog_ended(struct dlg_cell *dlg, int type, struct dlg_cb_params
*_params)
if( !msg || msg == FAKED_REPLY)
msg = _params->req;
call_control_stop(msg, dlg->callid);
- *_params->param = (void*)CCInactive;
+ *_params->param = NULL;
}
}
diff --git a/modules/http_client/http_client.c b/modules/http_client/http_client.c
index 9a6c269..3efb0ee 100644
--- a/modules/http_client/http_client.c
+++ b/modules/http_client/http_client.c
@@ -508,6 +508,7 @@ static int w_curl_connect(struct sip_msg* _m, char* _con, char * _url,
char* _re
if (_con == NULL || _url == NULL || _result == NULL) {
LM_ERR("Invalid parameter\n");
+ return -1;
}
con.s = _con;
con.len = strlen(con.s);
@@ -546,6 +547,7 @@ static int w_curl_connect_post(struct sip_msg* _m, char* _con, char *
_url, char
if (_con == NULL || _url == NULL || _data == NULL || _result == NULL) {
LM_ERR("Invalid parameter\n");
+ return -1;
}
con.s = _con;
con.len = strlen(con.s);
@@ -782,6 +784,7 @@ static int w_curl_get_redirect(struct sip_msg* _m, char* _con, char*
_result) {
if (_con == NULL || _result == NULL) {
LM_ERR("Invalid parameter\n");
+ return -1;
}
con.s = _con;
con.len = strlen(con.s);
diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c
index f96a635..5b37add 100644
--- a/modules/mediaproxy/mediaproxy.c
+++ b/modules/mediaproxy/mediaproxy.c
@@ -1926,7 +1926,7 @@ __dialog_ended(struct dlg_cell *dlg, int type, struct dlg_cb_params
*_params)
{
if ((int)(long)*_params->param == MPActive) {
end_media_session(dlg->callid, dlg->tag[DLG_CALLER_LEG],
dlg->tag[DLG_CALLEE_LEG]);
- *_params->param = MPInactive;
+ *_params->param = NULL;
}
}
diff --git a/modules/rr/record.c b/modules/rr/record.c
index b8f526e..6c7cc05 100644
--- a/modules/rr/record.c
+++ b/modules/rr/record.c
@@ -492,7 +492,7 @@ int record_route(struct sip_msg* _m, str *params)
int record_route_preset(struct sip_msg* _m, str* _data)
{
str user = {NULL, 0};
- struct to_body* from;
+ struct to_body* from = NULL;
struct lump* l;
char* hdr, *p;
int hdr_len;
@@ -511,10 +511,6 @@ int record_route_preset(struct sip_msg* _m, str* _data)
rr_prefix_len = RR_PREFIX_SIPS_LEN;
}
- from = 0;
- user.len = 0;
- user.s = 0;
-
if (add_username) {
if (get_username(_m, &user) < 0) {
LM_ERR("failed to extract username\n");
diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c
index 8a3fb7b..83eae4d 100644
--- a/modules/sipcapture/sipcapture.c
+++ b/modules/sipcapture/sipcapture.c
@@ -626,13 +626,13 @@ void * capture_mode_init(str *name, str * params) {
return n;
error:
- if (n->name.s){
- pkg_free(n->name.s);
- }
- if (n->table_names){
- pkg_free(n->table_names);
- }
if (n){
+ if (n->name.s){
+ pkg_free(n->name.s);
+ }
+ if (n->table_names){
+ pkg_free(n->table_names);
+ }
pkg_free(n);
}
return 0;
diff --git a/modules/uid_domain/uid_domain_mod.c b/modules/uid_domain/uid_domain_mod.c
index fda7bb9..abe43d5 100644
--- a/modules/uid_domain/uid_domain_mod.c
+++ b/modules/uid_domain/uid_domain_mod.c
@@ -433,7 +433,7 @@ static int db_load_domain(domain_t** d, unsigned long flags, str*
domain)
static int lookup_domain(struct sip_msg* msg, char* flags, char* fp)
{
str domain, tmp;
- domain_t* d;
+ domain_t* d = NULL;
int ret = -1;
if (get_str_fparam(&domain, msg, (fparam_t*)fp) != 0) {
@@ -527,13 +527,12 @@ int reload_domain_list(void)
static int lookup_domain_fixup(void** param, int param_no)
{
- unsigned long flags;
+ unsigned long flags=0;
char* s;
if (param_no == 1) {
/* Determine the track and class of attributes to be loaded */
s = (char*)*param;
- flags = 0;
if (*s != '$' || (strlen(s) != 3)) {
ERR("Invalid parameter value, $xy expected\n");
return -1;