diff --git a/src/udp.c b/src/udp.c index bbaff41..119e777 100644 --- a/src/udp.c +++ b/src/udp.c @@ -184,7 +184,7 @@ int udp_ipv6(struct s_ethernet *eth6, struct s_ipv6 *ip6, char *payload) } /* allocate memory for translated packet */ - packet_size = sizeof(struct s_ipv4) + ip6->len; + packet_size = sizeof(struct s_ipv4) + htons(ip6->len); if ((packet = (unsigned char *) malloc(packet_size)) == NULL) { fprintf(stderr, "[Error] Lack of free memory\n"); return 1;