aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoremanuele-f <faranda@ntop.org>2019-12-04 13:06:05 +0100
committeremanuele-f <faranda@ntop.org>2019-12-04 13:06:05 +0100
commitd62526f9ed0d504c928a3861b4838f7029bc0632 (patch)
tree7326cf5478a6e6dc78f2ac0e15d83f1ed8c8e2c7 /src
parente66d7216b8de3aa479db82486dcf64a63d8353ff (diff)
Fix invalid reads and add valgrind test
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/http.c2
-rw-r--r--src/lib/protocols/ssh.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 4382879d0..70ca0c389 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -484,7 +484,7 @@ static u_int16_t http_request_url_offset(struct ndpi_detection_module_struct *nd
packet->payload_packet_len);
/* Check first char */
- if(!strchr(http_fs,packet->payload[0])) return 0;
+ if(!packet->payload_packet_len || !strchr(http_fs,packet->payload[0])) return 0;
/**
FIRST PAYLOAD PACKET FROM CLIENT
**/
diff --git a/src/lib/protocols/ssh.c b/src/lib/protocols/ssh.c
index 5bdf78959..068d2c345 100644
--- a/src/lib/protocols/ssh.c
+++ b/src/lib/protocols/ssh.c
@@ -296,7 +296,7 @@ static void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct
flow->l4.tcp.ssh_stage = 3;
return;
}
- } else {
+ } else if(packet->payload_packet_len > 5) {
u_int8_t msgcode = *(packet->payload + 5);
ndpi_MD5_CTX ctx;