Skip to content

Commit 6dc5261

Browse files
leodidognosek
authored andcommitted
fix(userspace/libsinsp): constraint printing of iface info (name, address, etc.)
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent 55b1cc8 commit 6dc5261

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: userspace/libsinsp/ifinfo.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ sinsp_ipv4_ifinfo::sinsp_ipv4_ifinfo(uint32_t addr, uint32_t netmask, uint32_t b
4040
void sinsp_ipv4_ifinfo::convert_to_string(char * dest, const uint32_t addr)
4141
{
4242
sprintf(
43-
dest,
44-
"%d.%d.%d.%d",
43+
dest,
44+
"%d.%d.%d.%d",
4545
(addr & 0xFF),
4646
((addr & 0xFF00) >> 8),
4747
((addr & 0xFF0000) >> 16),
@@ -65,7 +65,7 @@ string sinsp_ipv4_ifinfo::to_string() const
6565
convert_to_string(str_addr, m_addr);
6666
convert_to_string(s_netmask, m_netmask);
6767
convert_to_string(s_bcast, m_bcast);
68-
sprintf(s, "%s inet %s netmask %s broadcast %s", m_name.c_str(), str_addr, s_netmask, s_bcast);
68+
snprintf(s, sizeof(s), "%s inet %s netmask %s broadcast %s", m_name.c_str(), str_addr, s_netmask, s_bcast);
6969
return string(s);
7070
}
7171

@@ -230,7 +230,7 @@ bool sinsp_network_interfaces::is_ipv4addr_in_local_machine(uint32_t addr, sinsp
230230

231231
//
232232
// Note: if we don't have container info, any pick we make is arbitrary.
233-
// To at least achieve consistency across client and server, we just match the host interface addresses.
233+
// To at least achieve consistency across client and server, we just match the host interface addresses.
234234
//
235235
if(container_info)
236236
{

0 commit comments

Comments
 (0)