Skip to content

Commit

Permalink
core: improve header safe guards for Via handling
Browse files Browse the repository at this point in the history
(cherry picked from commit ad68e40)
  • Loading branch information
henningw committed Jun 3, 2018
1 parent 0045f52 commit f07dabf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/core/crc.c
Expand Up @@ -231,6 +231,8 @@ void crcitt_string_array( char *dst, str src[], int size )
ccitt = 0xFFFF; ccitt = 0xFFFF;
str_len=CRC16_LEN; str_len=CRC16_LEN;
for (i=0; i<size; i++ ) { for (i=0; i<size; i++ ) {
/* invalid str with positive length and null char pointer */
if( unlikely(src[i].s==NULL)) break;
c=src[i].s; c=src[i].s;
len=src[i].len; len=src[i].len;
while(len) { while(len) {
Expand Down
11 changes: 8 additions & 3 deletions src/core/msg_translator.c
Expand Up @@ -168,12 +168,17 @@ static int check_via_address(struct ip_addr* ip, str *name,
(name->s[name->len-1]==']')&& (name->s[name->len-1]==']')&&
(strncasecmp(name->s+1, s, len)==0)) (strncasecmp(name->s+1, s, len)==0))
) )
) ) {
return 0; return 0;
else }

else {
if (unlikely(name->s==NULL)) {
LM_CRIT("invalid Via host name\n");
return -1;
}
if (strncmp(name->s, s, name->len)==0) if (strncmp(name->s, s, name->len)==0)
return 0; return 0;
}
}else{ }else{
LM_CRIT("could not convert ip address\n"); LM_CRIT("could not convert ip address\n");
return -1; return -1;
Expand Down

0 comments on commit f07dabf

Please sign in to comment.