Added calllist option to nlookup, fixed bunch of PVS-Studio lint warnings
Altlinux build / build-alt (push) Successful in 2m34s
Archlinux build / build-arch (push) Successful in 2m55s
Archlinux build / make-test (push) Successful in 1m0s
Debian build / build-ubuntu (push) Successful in 3m43s

This commit is contained in:
zx
2025-04-26 07:56:48 +03:00
parent 7903fd08af
commit 81b326ca45
13 changed files with 235 additions and 28 deletions
+71
View File
@@ -354,6 +354,77 @@ int nodelist_parsestring(s_node *node, char *str)
return 0;
}
/*****************************************************************************
* Hidden adresses adder
*
* Arguments:
* node a node for which we add HIDDEN lines with IpAddr
* str pointer to the flags string
*
* Return value:
* -1 if error
* zero value if string had no hidden INA:, pos - num of INA's above
* first
*/
int nodelist_parsehiddenina(s_node *node,s_override *ov) {
int rc = 0;
s_override *ovr;
s_override *ovrbase = ov;
char *tmp, *p, *q;
const char *searchbase = node->flags;
int flaglen = 3;
tmp = xmalloc(BNI_MAXHOST+1);
while( p = strstr(searchbase, "INA") )
{
if( p == node->flags || *(p-1) == ',' ) // match flag
{
if( *(p+flaglen) == 0 || *(p+flaglen) == ',' )
{
// empty flag
strncpy(tmp, p,'\0');
}
else
{
if( *(p+flaglen) == ':' ) {
// flag has data
p += flaglen + 1; // start of data
q = strchrnul(p, ','); // end of data: comma or EOS
strncpy(tmp, p, q-p);
tmp[q-p]='\0';
if (!strcmp(tmp, node->host)) {
DEB((D_NODELIST, "nodelist: found host INA %s", tmp));
} else {
DEB((D_NODELIST, "nodelist: found hidden INA %s", tmp));
rc += 1;
// let's find last override to add
while (ovrbase->hidden != NULL) ovrbase = ovrbase->hidden;
// and add new element to hiddens:
ovr = xmalloc(sizeof(s_override));
memset(ovr,'\0',sizeof(s_override));
ovr->hidden = NULL;
ovr->sIpaddr = xstrcpy(tmp);
ovr->addr = node->addr;
ovrbase->hidden = ovr;
}
}
}
}
searchbase = p + 1;
}
free(tmp);
return rc;
//
}
/*****************************************************************************
* Open nodelist, nodelist index, do some checks
*
+1 -1
View File
@@ -439,7 +439,7 @@ char *emsi_createdat(s_emsi *emsi)
* Write total length of <data_pkt>
*/
sprintf(buf, "%04hX", (short unsigned)strlen(tmp+14));
memcpy(tmp+10, buf, 4);
memcpy(tmp+10, buf, 4); //-V1086
return(tmp);
}
+1 -1
View File
@@ -90,7 +90,7 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *myhello)
char *q;
if( strlen(myhello->system) + strlen(state.localaddrs[0].addr.domain) > 57 )
{
if( strlen(state.localaddrs[0].addr.domain) < 60 ) //PVS-Suppress V547
if( strlen(state.localaddrs[0].addr.domain) < 60 ) //-V0547
q = p + (60 - strlen(state.localaddrs[0].addr.domain));
else
q = p;
+2 -2
View File
@@ -81,13 +81,13 @@ void yoohoo_deinit(s_handshake_protocol *THIS)
ASSERT(THIS->remote_data);
ASSERT(THIS->local_data);
if( THIS->remote_data )
if( THIS->remote_data ) //-V0547
{
memset(THIS->remote_data, '\0', sizeof(s_yoohoo_sysinfo));
free(THIS->remote_data);
}
if( THIS->local_data )
if( THIS->local_data ) //-V0547
{
memset(THIS->local_data, '\0', sizeof(s_yoohoo_sysinfo));
free(THIS->local_data);
+4 -5
View File
@@ -283,15 +283,14 @@ int session_stat_update(s_faddr *addr, s_sess_stat *stat, bool caller, int rc)
stat->tries_nodial++;
if( BFERR_CANT_CONNECT10 <= rc && rc <= BFERR_CANT_CONNECT19 )
stat->tries_noconn++;
if( rc >= BFERR_CONNECT_TOOLOW )
stat->tries_sessns++;
/* Reset some counters */
if( rc >= BFERR_CONNECT_TOOLOW )
if( rc >= BFERR_CONNECT_TOOLOW )
{
stat->tries_sessns++;
/* Reset some counters */
stat->tries_noansw = TRIES_RESET;
stat->tries_noconn = TRIES_RESET;
}
if( rc > BFERR_HANDSHAKE_ERROR )
stat->tries_hshake = TRIES_RESET;
}
+1 -2
View File
@@ -178,8 +178,7 @@ char *file_gettmp(void)
res = string_concat(tmp, chunk, '\0');
if( chunk )
free(chunk);
free(chunk);
if( !res )
free(tmp);
}
+1 -1
View File
@@ -176,7 +176,7 @@ int strcasemask(const char *str, const char *mask)
}
}
return( *s != '\0' || *m != '\0' );
return( *s != '\0' || *m != '\0' ); //-V0560 It seems more logical
}
/*****************************************************************************
+1 -1
View File
@@ -155,7 +155,7 @@ int plock_create(const char *lockname)
char *tmpname, *p, *chunk;
chunk = xmalloc(7);
if (!chunk) {
logerr("can't generate unique file name from \"%s\"", tmpname);
logerr("can't malloc mem for generation of lock name");
DEB((D_FREE, "plock freed"));
return PLOCK_ERROR;
}
+4 -4
View File
@@ -216,7 +216,7 @@ char *string_chomp(char *str)
ASSERT(str != NULL);
if( str && *str )
if( *str )
{
p = str + strlen(str + 1);
if( *p == '\n' )
@@ -383,7 +383,7 @@ char *string_trimright(char *str)
ASSERT(str != NULL);
if( str && *str )
if( *str )
{
p = str + strlen(str+1);
while( p >= str && isspace(*p) ) *p-- = '\0';
@@ -407,7 +407,7 @@ char *string_trimleft(char *str)
ASSERT(str != NULL);
if( str && *str )
if( *str )
{
p = str;
while( isspace(*p) ) p++;
@@ -433,7 +433,7 @@ char *string_trimboth(char *str)
ASSERT(str != NULL);
if( str && *str )
if( *str )
{
/* Remove leading spaces */
p = str;
+1 -1
View File
@@ -469,7 +469,7 @@ int timevec_parse(s_timevec *dest, const char *str)
end_day = beg_day;
if( beg_day >= DAY_MONDAY && beg_day <= DAY_SUNDAY )
if( beg_day <= DAY_SUNDAY )
str += 3;
else if( beg_day == DAY_ANY )
str += 3;