diff options
author | Luca Deri <deri@ntop.org> | 2019-08-29 16:17:43 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-08-29 16:17:43 +0200 |
commit | 68f6310222f5045a3d7dcedc2927847040d7cbe8 (patch) | |
tree | 024fb705d705ca05f5a275c27baa7346f887e8c0 /src/lib/protocols/ajp.c | |
parent | c3284526871f164de42227a3cb466cd3f2f2a335 (diff) |
AJP crash fix
Diffstat (limited to 'src/lib/protocols/ajp.c')
-rw-r--r-- | src/lib/protocols/ajp.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/protocols/ajp.c b/src/lib/protocols/ajp.c index 7cae40f20..335a29728 100644 --- a/src/lib/protocols/ajp.c +++ b/src/lib/protocols/ajp.c @@ -70,18 +70,17 @@ static void set_ajp_detected(struct ndpi_detection_module_struct *ndpi_struct, /*************************************************************************************************/ static void ndpi_check_ajp(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow) -{ + struct ndpi_flow_struct *flow) { struct ajp_header ajp_hdr; - struct ndpi_packet_struct *packet = &flow->packet; - if (packet->payload_packet_len < 5 /* ajp_header size*/) { + if (packet->payload_packet_len < sizeof(ajp_hdr)) { NDPI_EXCLUDE_PROTO(ndpi_struct, flow); return; } - ajp_hdr = *((struct ajp_header *) (packet->payload)); + memcpy(&ajp_hdr, packet->payload, sizeof(struct ajp_header)); + ajp_hdr.magic = ntohs(ajp_hdr.magic); ajp_hdr.len = ntohs(ajp_hdr.len); |