Skip to content

Commit

Permalink
fixing coverity found defects - memory corruption, null dereference
Browse files Browse the repository at this point in the history
(cherry picked from commit fd57609)
(cherry picked from commit 56a7230)
  • Loading branch information
ph4r05 authored and liviuchircu committed Jan 18, 2016
1 parent 79f19c7 commit 4ff4715
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/enum/enum.c
Expand Up @@ -400,6 +400,12 @@ int is_from_user_enum_2(struct sip_msg* _msg, char* _suffix, char* _service)
proto = PROTO_NONE;
he = sip_resolvehost(&luri.host, &zp, &proto,
(luri.type==SIPS_URI_T)?1:0 , 0);
if (he == NULL){
LM_ERR("Resolving URI <%.*s> failed\n",
result.len, result.s);
free_rdata_list(head); /*clean up*/
return -9;
}

hostent2ip_addr(&addr, he, 0);

Expand Down
5 changes: 5 additions & 0 deletions modules/permissions/rule.c
Expand Up @@ -128,6 +128,11 @@ expression *new_expression(char *str)
return 0;
}

if (strlen(str) > EXPRESSION_LENGTH){
LM_ERR("expresion too long\n");
pkg_free(e);
return 0;
}
strcpy(e->value, str);

e->reg_value = (regex_t*)pkg_malloc(sizeof(regex_t));
Expand Down

0 comments on commit 4ff4715

Please sign in to comment.