Merge pull request #695 from pallas/avoid-memcached-short-read

memcached: fix invalid read on short packet
This commit is contained in:
Luca Deri
2019-04-12 19:19:46 +02:00
committed by GitHub
+2 -1
View File
@@ -89,7 +89,7 @@
#define MEMCACHED_MIN_MATCH 2 /* Minimum number of command/responses required */
#define MEMCACHED_MATCH(cr) memcmp(offset, cr, cr ## _LEN)
#define MEMCACHED_MATCH(cr) (cr ## _LEN > length || memcmp(offset, cr, cr ## _LEN))
static void ndpi_int_memcached_add_connection(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow)
@@ -105,6 +105,7 @@ void ndpi_search_memcached(
{
struct ndpi_packet_struct *packet = &flow->packet;
const u_int8_t *offset = packet->payload;
const u_int16_t length = packet->payload_packet_len;
u_int8_t *matches;
NDPI_LOG_DBG(ndpi_struct, "search memcached\n");