Skip to content

Commit

Permalink
fix(userspace/libsinsp): constraint printing of iface info (name, add…
Browse files Browse the repository at this point in the history
…ress, etc.)

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
  • Loading branch information
leodido authored and gnosek committed Aug 6, 2019
1 parent 55b1cc8 commit 6dc5261
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions userspace/libsinsp/ifinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ sinsp_ipv4_ifinfo::sinsp_ipv4_ifinfo(uint32_t addr, uint32_t netmask, uint32_t b
void sinsp_ipv4_ifinfo::convert_to_string(char * dest, const uint32_t addr)
{
sprintf(
dest,
"%d.%d.%d.%d",
dest,
"%d.%d.%d.%d",
(addr & 0xFF),
((addr & 0xFF00) >> 8),
((addr & 0xFF0000) >> 16),
Expand All @@ -65,7 +65,7 @@ string sinsp_ipv4_ifinfo::to_string() const
convert_to_string(str_addr, m_addr);
convert_to_string(s_netmask, m_netmask);
convert_to_string(s_bcast, m_bcast);
sprintf(s, "%s inet %s netmask %s broadcast %s", m_name.c_str(), str_addr, s_netmask, s_bcast);
snprintf(s, sizeof(s), "%s inet %s netmask %s broadcast %s", m_name.c_str(), str_addr, s_netmask, s_bcast);
return string(s);
}

Expand Down Expand Up @@ -230,7 +230,7 @@ bool sinsp_network_interfaces::is_ipv4addr_in_local_machine(uint32_t addr, sinsp

//
// Note: if we don't have container info, any pick we make is arbitrary.
// To at least achieve consistency across client and server, we just match the host interface addresses.
// To at least achieve consistency across client and server, we just match the host interface addresses.
//
if(container_info)
{
Expand Down

0 comments on commit 6dc5261

Please sign in to comment.