Skip to content

Commit

Permalink
evapi: Removed cast of bind port to short, as this restricted ports t…
Browse files Browse the repository at this point in the history
…o signed 16-bit int values (< 32768).

htons() takes unsigned 16-bit integer and returns the same. When this value was cast to (short), higher ports could not be used.
  • Loading branch information
abalashov committed Nov 9, 2019
1 parent 6d036dc commit e9545ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/evapi/evapi_dispatch.c
Expand Up @@ -676,7 +676,7 @@ int evapi_run_dispatcher(char *laddr, int lport)

bzero(&evapi_srv_addr, sizeof(evapi_srv_addr));
evapi_srv_addr.sin_family = h->h_addrtype;
evapi_srv_addr.sin_port = htons((short)lport);
evapi_srv_addr.sin_port = htons(lport);
evapi_srv_addr.sin_addr = *(struct in_addr*)h->h_addr;

/* Set SO_REUSEADDR option on listening socket so that we don't
Expand Down
2 changes: 1 addition & 1 deletion src/modules/evapi/evapi_mod.c
Expand Up @@ -151,7 +151,7 @@ static int mod_init(void)
p = strchr(_evapi_bind_param, ':');
if(p!=NULL) {
*p++ = '\0';
_evapi_bind_port = (short)atoi(p);
_evapi_bind_port = atoi(p);
if (_evapi_bind_port <= 0) {
LM_ERR("invalid port: %d\n", _evapi_bind_port);
return -1;
Expand Down

0 comments on commit e9545ae

Please sign in to comment.