mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
client: avoid passing uninitialized address to format_name()
The clang memory sanitizer seems to trigger on an uninitialized value passed to format_name() when the source is a refclock, even though the value is not used for anything. Pass 0 in this case to avoid the error.
This commit is contained in:
7
client.c
7
client.c
@@ -1979,7 +1979,7 @@ process_cmd_sources(char *line)
|
||||
IPAddr ip_addr;
|
||||
uint32_t i, mode, n_sources;
|
||||
char name[256], mode_ch, state_ch;
|
||||
int all, verbose;
|
||||
int all, verbose, ref;
|
||||
|
||||
parse_sources_options(line, &all, &verbose);
|
||||
|
||||
@@ -2016,9 +2016,8 @@ process_cmd_sources(char *line)
|
||||
if (!all && ip_addr.family == IPADDR_ID)
|
||||
continue;
|
||||
|
||||
format_name(name, sizeof (name), 25,
|
||||
mode == RPY_SD_MD_REF && ip_addr.family == IPADDR_INET4,
|
||||
ip_addr.addr.in4, 1, &ip_addr);
|
||||
ref = mode == RPY_SD_MD_REF && ip_addr.family == IPADDR_INET4;
|
||||
format_name(name, sizeof (name), 25, ref, ref ? ip_addr.addr.in4 : 0, 1, &ip_addr);
|
||||
|
||||
switch (mode) {
|
||||
case RPY_SD_MD_CLIENT:
|
||||
|
||||
Reference in New Issue
Block a user