Skip to content

Commit

Permalink
gnrc_sock_ip: fix memcpy()/memset() sizeof-type
Browse files Browse the repository at this point in the history
The type in the `sizeof()` is just plain wrong. This fixes it.
  • Loading branch information
miri64 committed Nov 8, 2016
1 parent 0c22fff commit 14c9855
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sys/net/gnrc/sock/ip/gnrc_sock_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "gnrc_sock_internal.h"

int sock_ip_create(sock_ip_t *sock, const sock_ip_ep_t *local,
const sock_ip_ep_t *remote, uint8_t proto, uint16_t flags)
const sock_ip_ep_t *remote, uint8_t proto, uint16_t flags)
{
assert(sock);
if ((local != NULL) && (remote != NULL) &&
Expand All @@ -41,17 +41,17 @@ int sock_ip_create(sock_ip_t *sock, const sock_ip_ep_t *local,
if (gnrc_af_not_supported(local->family)) {
return -EAFNOSUPPORT;
}
memcpy(&sock->local, local, sizeof(sock_ip_t));
memcpy(&sock->local, local, sizeof(sock_ip_ep_t));
}
memset(&sock->remote, 0, sizeof(sock_ip_t));
memset(&sock->remote, 0, sizeof(sock_ip_ep_t));
if (remote != NULL) {
if (gnrc_af_not_supported(remote->family)) {
return -EAFNOSUPPORT;
}
if (gnrc_ep_addr_any(remote)) {
return -EINVAL;
}
memcpy(&sock->remote, remote, sizeof(sock_ip_t));
memcpy(&sock->remote, remote, sizeof(sock_ip_ep_t));
}
gnrc_sock_create(&sock->reg, GNRC_NETTYPE_IPV6,
proto);
Expand Down

0 comments on commit 14c9855

Please sign in to comment.