Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/plugin-sdbus/plugin-ipwatchd/analyse.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void ipwd_analyse (u_char * args, const struct pcap_pkthdr *header, const u_char
ipwd_message (IPWD_MSG_TYPE_INFO, "IP conflict with: %s %s-%s",
check_context.ip, check_context.dev.mac, rcv_smac);
check_context.conflic_mac = (char*)malloc(IPWD_MAX_DEVICE_ADDRESS_LEN);
if (check_context.conflic_mac == NULL) {
ipwd_message (IPWD_MSG_TYPE_ERROR, "Unable to allocate memory for conflic_mac - malloc failed");
return;
}
memcpy(check_context.conflic_mac,rcv_smac,IPWD_MAX_DEVICE_ADDRESS_LEN);
}
}
Expand Down Expand Up @@ -255,6 +259,10 @@ void ipwd_analyse (u_char * args, const struct pcap_pkthdr *header, const u_char
if (exist == 0)
{
IPCONFLICT_DEV_INFO *newdevinfo = (IPCONFLICT_DEV_INFO *)malloc(sizeof(IPCONFLICT_DEV_INFO));
if (newdevinfo == NULL) {
ipwd_message (IPWD_MSG_TYPE_ERROR, "Unable to allocate memory for IPCONFLICT_DEV_INFO - malloc failed");
return;
}
memcpy (newdevinfo->ip, devices.dev[i].ip, IPWD_MAX_DEVICE_ADDRESS_LEN);
memcpy (newdevinfo->mac, devices.dev[i].mac, IPWD_MAX_DEVICE_ADDRESS_LEN);
memcpy (newdevinfo->remote_mac, rcv_smac, IPWD_MAX_DEVICE_ADDRESS_LEN);
Expand Down
5 changes: 5 additions & 0 deletions src/plugin-sdbus/plugin-ipwatchd/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ int ipwd_read_config (const char *filename)
devices.devnum = 0;

ipconflict_dev_info = (IPCONFLICT_DEV_INFO *)malloc(sizeof(IPCONFLICT_DEV_INFO));
if (ipconflict_dev_info == NULL)
{
ipwd_message (IPWD_MSG_TYPE_ERROR, "Unable to allocate memory for ipconflict_dev_info - malloc failed");
return (IPWD_RV_ERROR);
}
memset(ipconflict_dev_info->ip, 0, IPWD_MAX_DEVICE_ADDRESS_LEN);
memset(ipconflict_dev_info->mac, 0, IPWD_MAX_DEVICE_ADDRESS_LEN);
memset(ipconflict_dev_info->remote_mac, 0, IPWD_MAX_DEVICE_ADDRESS_LEN);
Expand Down