Skip to content

Commit

Permalink
Fixed abusive strlen on NULL params in mod_init
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-iancu committed Apr 16, 2019
1 parent 6b9ef88 commit b0d90db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/msilo/msilo.c
Expand Up @@ -276,10 +276,6 @@ static int mod_init(void)

init_db_url( ms_db_url , 0 /*cannot be null*/);
ms_db_table.len = strlen (ms_db_table.s);
ms_from.len = strlen (ms_from.s);
ms_contact.len = strlen (ms_contact.s);
ms_content_type.len = strlen (ms_content_type.s);
ms_offline_message.len = strlen (ms_offline_message.s);
sc_mid.len = strlen(sc_mid.s);
sc_from.len = strlen(sc_from.s);
sc_to.len = strlen(sc_to.s);
Expand Down Expand Up @@ -348,27 +344,31 @@ static int mod_init(void)

if(ms_from.s!=NULL)
{
ms_from.len = strlen (ms_from.s);
if (pv_parse_format(&ms_from, &ms_from_sp) < 0) {
LM_ERR("Failed to parse formatted string in parameter\n");
return -1;
}
}
if(ms_contact.s!=NULL)
{
ms_contact.len = strlen (ms_contact.s);
if (pv_parse_format(&ms_contact, &ms_contact_sp) < 0) {
LM_ERR("Failed to parse formatted string in parameter\n");
return -1;
}
}
if(ms_content_type.s!=NULL)
{
ms_content_type.len = strlen (ms_content_type.s);
if (pv_parse_format(&ms_content_type, &ms_content_type_sp) < 0) {
LM_ERR("Failed to parse formatted string in parameter\n");
return -1;
}
}
if(ms_offline_message.s!=NULL)
{
ms_offline_message.len = strlen (ms_offline_message.s);
if (pv_parse_format(&ms_offline_message, &ms_offline_message_sp) < 0) {
LM_ERR("Failed to parse formatted string in parameter\n");
return -1;
Expand Down

0 comments on commit b0d90db

Please sign in to comment.