diff options
author | Thomas Markwalder <tmark@isc.org> | 2014-08-25 13:22:29 -0400 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2014-08-25 13:22:29 -0400 |
commit | 36e2c22493c0f2357aec2ccf4ed37c2eb676bc56 (patch) | |
tree | 4b25c231829bb0dbeadc9d2d0255373b089b2d59 /common/lpf.c | |
parent | a6365d17d1d8601601539b58f9a3aa03415a6dbb (diff) | |
download | isc-dhcp-36e2c22493c0f2357aec2ccf4ed37c2eb676bc56.tar.gz |
[master] Corrects high impact issues reported by Coverity.
Merges in rt36712
Diffstat (limited to 'common/lpf.c')
-rw-r--r-- | common/lpf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/lpf.c b/common/lpf.c index ba052063..a63d61ba 100644 --- a/common/lpf.c +++ b/common/lpf.c @@ -95,6 +95,7 @@ int if_register_lpf (info) memset (&sa, 0, sizeof sa); sa.sa_family = AF_PACKET; strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data); + sa.sa_data[sizeof(sa.sa_data)-1] = '\0'; if (bind (sock, &sa, sizeof sa)) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || @@ -107,6 +108,7 @@ int if_register_lpf (info) log_fatal ("configuration!"); } log_fatal ("Bind socket to interface: %m"); + } get_hw_addr(info->name, &info->hw_address); @@ -328,6 +330,7 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) sa.spkt_family = AF_PACKET; strncpy ((char *)sa.spkt_device, (const char *)interface -> ifp, sizeof sa.spkt_device); + sa.spkt_device[sizeof(sa.spkt_device) - 1] = '\0'; sa.spkt_protocol = htons(ETH_P_IP); result = sendto (interface -> wfdesc, |