Skip to content

Commit

Permalink
app_mono: safety check for anchor lump
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 17, 2019
1 parent 875bd48 commit 5ce9849
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/app_mono/app_mono_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ static int sr_mono_hdr_append (MonoString *hv)
hdr[txt.len] = '\0';
anchor = anchor_lump(env_M->msg,
hf->name.s + hf->len - env_M->msg->buf, 0, 0);
if(insert_new_lump_before(anchor, hdr, txt.len, 0) == 0)
if((anchor==NULL) || (insert_new_lump_before(anchor, hdr, txt.len, 0) == 0))
{
LM_ERR("can't insert lump\n");
pkg_free(hdr);
Expand Down Expand Up @@ -873,7 +873,7 @@ static int sr_mono_hdr_insert (MonoString *hv)
hdr[txt.len] = '\0';
anchor = anchor_lump(env_M->msg,
hf->name.s + hf->len - env_M->msg->buf, 0, 0);
if(insert_new_lump_before(anchor, hdr, txt.len, 0) == 0)
if((anchor==NULL) || (insert_new_lump_before(anchor, hdr, txt.len, 0) == 0))
{
LM_ERR("can't insert lump\n");
pkg_free(hdr);
Expand Down

0 comments on commit 5ce9849

Please sign in to comment.