Skip to content

Commit

Permalink
strip_body(): check if content-type exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita committed Dec 23, 2015
1 parent a95341a commit c11af55
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/sipmsgops/sipmsgops.c
Expand Up @@ -1168,13 +1168,21 @@ static int strip_body_f(struct sip_msg *msg, char *str1, char *str2 )
return -1;
}

if (msg->content_type == NULL || msg->content_type->name.s == NULL ||
msg->content_type->name.len == 0) {
LM_WARN("You have a body but you don't have Content-Type! This is"
"not a valid SIP message! The body WILL BE stripped!\n");
goto out;
}

/* add delete content-type header lump */
if(del_lump(msg, msg->content_type->name.s- msg->buf, msg->content_type->len,
HDR_CONTENTTYPE_T) == 0) {
LM_ERR("failed to add lump to delete content type header\n");
return -1;
}

out:
return 1;
}

Expand Down

0 comments on commit c11af55

Please sign in to comment.