X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Frmr%2Fcommon%2Fsrc%2Ftools_static.c;h=cc95fc144398ee81d56aecf9ce0e0ef6d5ec44ca;hb=216a0497eafd860feb39eb34d7de1317d8cfe25b;hp=a69db35e116c1c482224dfea8fc692ee3e468d9e;hpb=fcea3951d44de0cc55d33c5e114487abe79d3406;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/common/src/tools_static.c b/src/rmr/common/src/tools_static.c index a69db35..cc95fc1 100644 --- a/src/rmr/common/src/tools_static.c +++ b/src/rmr/common/src/tools_static.c @@ -80,7 +80,7 @@ static inline int zt_buf_fill( char* dest, char const* src, int len ) { char const* sp; int n; // num moved - if( dest == NULL && src == NULL ) { + if( dest == NULL || src == NULL ) { return -1; } @@ -334,7 +334,7 @@ static if_addrs_t* mk_ip_list( char* port ) { struct ifaddrs *ele; // pointer into the list char octs[NI_MAXHOST+1]; char wbuf[NI_MAXHOST+128]; - char* fmt; + char* fmt = NULL; // address format (v4 or v6) char* envp; // at the environment var if there char* target_if = NULL; // target interface supplied by ENV_BIND_IF char* tok; @@ -379,7 +379,7 @@ static if_addrs_t* mk_ip_list( char* port ) { } } - if( *octs ) { + if( *octs && fmt != NULL ) { // possible that we didn't recognise the format (v4 or v6), don't try if we didn't if( (tok = strchr( octs, '%' )) != NULL ) { // for unknown reasons some ip6 addrs have %if-name appended; truncate *tok = 0; }