Browse Source

Crash fix

-l needs to be validated: added basic check (not enough TOFIX)
pull/474/head
Luca Deri 4 years ago
parent
commit
bbabf30bc5
  1. 7
      src/sn.c
  2. 2
      src/sn_utils.c

7
src/sn.c

@ -235,6 +235,7 @@ static int setOption(int optkey, char *_optarg, n2n_sn_t *sss) {
struct peer_info *anchor_sn;
size_t length;
int rv = -1;
char *double_column = strchr(_optarg, ':');
length = strlen(_optarg);
if(length >= N2N_EDGE_SN_HOST_SIZE) {
@ -242,6 +243,12 @@ static int setOption(int optkey, char *_optarg, n2n_sn_t *sss) {
break;
}
/* Need to check the format IP:port */
if(!double_column) {
traceEvent(TRACE_WARNING, "Invalid -l format: ignored");
return(-1);
}
if(sss->federation != NULL) {
socket = (n2n_sock_t *)calloc(1,sizeof(n2n_sock_t));

2
src/sn_utils.c

@ -737,7 +737,7 @@ static int sendto_mgmt(n2n_sn_t *sss,
* Evaluate first the MAC parameter and if it's zero-MAC, then it can skip HASH_FIND_PEER by MAC and search by socket
*/
struct peer_info* add_sn_to_federation_by_mac_or_sock(n2n_sn_t *sss,n2n_sock_t *sock, n2n_mac_t *mac) {
struct peer_info *scan, *tmp, *peer;
struct peer_info *scan, *tmp, *peer = NULL;
int found = 0;
if(sss->federation != NULL) {

Loading…
Cancel
Save