Fix some Packet initialisation.

This patch fixes Packet initialisation. In some place the pkt field
was not set after a memset used to zero the structure and this could
lead to some problems.
remotes/origin/master-1.1.x
Eric Leblond 15 years ago committed by Victor Julien
parent 8e95884333
commit 66a15e2d6d

@ -478,6 +478,7 @@ uint16_t AppLayerDetectGetProto(AlpProtoDetectCtx *ctx, AlpProtoDetectThreadCtx
if (p == NULL)
goto end;
memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
p->cuda_done = 0;
p->cuda_free_packet = 1;

@ -2757,7 +2757,7 @@ static int B2gCudaTest01(void)
Packet *p = SCMalloc(SIZE_OF_PACKET);
if (p == NULL)
return 0;
goto end;
memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
pb->packets_address_buffer[0] = p;
@ -2902,6 +2902,7 @@ static int B2gCudaTest02(void)
exit(EXIT_FAILURE);
}
memset(p[i], 0, SIZE_OF_PACKET);
p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&tv, &dtv, p[i], raw_eth, sizeof(raw_eth), NULL);
}
@ -3121,6 +3122,7 @@ static int B2gCudaTest03(void)
exit(EXIT_FAILURE);
}
memset(p[i], 0, SIZE_OF_PACKET);
p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&tv, &dtv, p[i], raw_eth, sizeof(raw_eth), NULL);
}
@ -3443,6 +3445,7 @@ static int B2gCudaTest04(void)
exit(EXIT_FAILURE);
}
memset(p[i], 0, sizeof(Packet));
p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&tv, &dtv, p[i], raw_eth, sizeof(raw_eth), NULL);
}
@ -3786,6 +3789,7 @@ static int B2gCudaTest05(void)
exit(EXIT_FAILURE);
}
memset(p[i], 0, sizeof(Packet));
p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&tv, &dtv, p[i], raw_eth, sizeof(raw_eth), NULL);
}

@ -66,6 +66,7 @@ Packet *UTHBuildPacketIPV6Real(uint8_t *payload, uint16_t payload_len,
if (p == NULL)
return NULL;
memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
TimeSet(&p->ts);
@ -259,6 +260,7 @@ Packet **UTHBuildPacketArrayFromEth(uint8_t *raw_eth[], int *pktsize, int numpkt
return NULL;
}
memset(p[i], 0, SIZE_OF_PACKET);
p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&th_v, &dtv, p[i], raw_eth[i], pktsize[i], NULL);
}
return p;
@ -280,6 +282,7 @@ Packet *UTHBuildPacketFromEth(uint8_t *raw_eth, uint16_t pktsize) {
if (p == NULL)
return NULL;
memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(th_v));

Loading…
Cancel
Save