Skip to content

Commit

Permalink
sipmsgops: fix null dereference
Browse files Browse the repository at this point in the history
Fixes Coverity CID 40620, 40621

(cherry picked from commit 49552fa95207c7e87036af376e0d2fe75854a463)
  • Loading branch information
razvancrainea committed Nov 14, 2016
1 parent 40f1c3d commit dcfbf0c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions modules/sipmsgops/sipmsgops.c
Expand Up @@ -727,8 +727,8 @@ static int add_hf_helper(struct sip_msg* msg, str *str1, str *str2,

memcpy(s, s0.s, s0.len);
if (str2) {
memcpy(s+str1->len, REQ_LINE(msg).uri.s, REQ_LINE(msg).uri.len);
memcpy(s+str1->len+REQ_LINE(msg).uri.len, str2->s, str2->len );
memcpy(s+s0.len, REQ_LINE(msg).uri.s, REQ_LINE(msg).uri.len);
memcpy(s+s0.len+REQ_LINE(msg).uri.len, str2->s, str2->len );
}

if (insert_new_lump_before(anchor, s, len, 0) == 0) {
Expand Down Expand Up @@ -1425,9 +1425,8 @@ static int fixup_sip_validate(void** param, int param_no)
str s;

if (param_no==1) {
if (!param) {
goto end;
}
if (!param)
return -1;
flags_s = (char*)*param;
end = flags_s + strlen(flags_s);

Expand Down Expand Up @@ -1458,7 +1457,6 @@ static int fixup_sip_validate(void** param, int param_no)
break;
}
}
end:
*param = (void *)(unsigned long)flags;
return 0;
} else if (param_no==2) {
Expand Down

0 comments on commit dcfbf0c

Please sign in to comment.