mirror of
https://code.semirocket.science/wrapsix
synced 2024-11-22 09:29:22 +02:00
Incorrect computing of packet size caused SIGSEGV
This commit is contained in:
parent
b28566bc64
commit
7012d02ab4
@ -219,7 +219,6 @@ int tcp_ipv6(struct s_ethernet *eth6, struct s_ipv6 *ip6, char *payload)
|
|||||||
unsigned short orig_checksum;
|
unsigned short orig_checksum;
|
||||||
struct s_ipv4 *ip4;
|
struct s_ipv4 *ip4;
|
||||||
unsigned char *packet;
|
unsigned char *packet;
|
||||||
unsigned int packet_size;
|
|
||||||
|
|
||||||
/* parse TCP header */
|
/* parse TCP header */
|
||||||
tcp = (struct s_tcp *) payload;
|
tcp = (struct s_tcp *) payload;
|
||||||
@ -249,8 +248,8 @@ int tcp_ipv6(struct s_ethernet *eth6, struct s_ipv6 *ip6, char *payload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for translated packet */
|
/* allocate memory for translated packet */
|
||||||
packet_size = sizeof(struct s_ipv4) + ip6->len;
|
if ((packet = (unsigned char *) malloc(sizeof(struct s_ipv4) +
|
||||||
if ((packet = (unsigned char *) malloc(packet_size)) == NULL) {
|
htons(ip6->len))) == NULL) {
|
||||||
fprintf(stderr, "[Error] Lack of free memory\n");
|
fprintf(stderr, "[Error] Lack of free memory\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user