Fix a copy issue in PacketCopyDataOffset.

remotes/origin/master-1.1.x
Victor Julien 15 years ago
parent 8978266a91
commit f5674eff74

@ -93,10 +93,12 @@ Packet *PacketGetFromQueueOrAlloc(void) {
*/ */
Packet *PacketPseudoPktSetup(Packet *parent, uint8_t *pkt, uint16_t len, uint8_t proto) Packet *PacketPseudoPktSetup(Packet *parent, uint8_t *pkt, uint16_t len, uint8_t proto)
{ {
SCEnter();
/* get us a packet */ /* get us a packet */
Packet *p = PacketGetFromQueueOrAlloc(); Packet *p = PacketGetFromQueueOrAlloc();
if (p == NULL) { if (p == NULL) {
return NULL; SCReturnPtr(NULL, "Packet");
} }
/* set the root ptr to the lowest layer */ /* set the root ptr to the lowest layer */
@ -126,7 +128,7 @@ Packet *PacketPseudoPktSetup(Packet *parent, uint8_t *pkt, uint16_t len, uint8_t
* is the packet we will now run through the system separately. We do * is the packet we will now run through the system separately. We do
* check it against the ip/port/other header checks though */ * check it against the ip/port/other header checks though */
DecodeSetNoPayloadInspectionFlag(parent); DecodeSetNoPayloadInspectionFlag(parent);
return p; SCReturnPtr(p, "Packet");
} }
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv) void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
@ -273,7 +275,7 @@ inline int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datale
return -1; return -1;
} }
/* copy initial data */ /* copy initial data */
memcpy(p->ext_pkt, &p->pkt, p->pktlen); memcpy(p->ext_pkt, GET_PKT_DIRECT_DATA(p), GET_PKT_DIRECT_MAX_SIZE(p));
/* copy data as asked */ /* copy data as asked */
memcpy(p->ext_pkt + offset, data, datalen); memcpy(p->ext_pkt + offset, data, datalen);
} }

Loading…
Cancel
Save