Skip to content

Commit

Permalink
lcr: remove excessive checks for the 'src_port' accuracy
Browse files Browse the repository at this point in the history
Remove unneeded check for 'src_port' in:
- ki_from_any_gw_addr()
- ki_from_gw_addr()

Which makes no sense because 'src_port' is of type 'unsigned int',
and the check concerns whether it's less than 0 or not.
  • Loading branch information
zenichev authored and linuxmaniac committed Aug 25, 2021
1 parent 9115d74 commit 536736f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/modules/lcr/lcr_mod.c
Expand Up @@ -3093,9 +3093,9 @@ static int ki_from_gw_addr(
return -1;
}

/* src_port set to 0 means we don't want to check it */
if((src_port < 0) || (src_port > 65535)) {
LM_ERR("invalid port parameter value %d\n", transport);
/* src_port set to 0 is allowed and means we don't want to check it */
if(src_port > 65535) {
LM_ERR("invalid port parameter value %d\n", src_port);
return -1;
}

Expand Down Expand Up @@ -3215,9 +3215,9 @@ static int ki_from_any_gw_addr(sip_msg_t *_m, str *addr_str, int transport, unsi
return -1;
}

/* src_port set to 0 means we don't want to check it */
if((src_port < 0) || (src_port > 65535)) {
LM_ERR("invalid port parameter value %d\n", transport);
/* src_port set to 0 is allowed and means we don't want to check it */
if(src_port > 65535) {
LM_ERR("invalid port parameter value %d\n", src_port);
return -1;
}

Expand Down

0 comments on commit 536736f

Please sign in to comment.