aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/stun.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-12-09 18:02:48 +0100
committerLuca Deri <deri@ntop.org>2019-12-09 18:02:48 +0100
commit6d7f3976f33b0d4fbbece60d6b7d549b13107674 (patch)
tree8a6c4f84d013d3b0eeeb76037c5fd8b4da0f2516 /src/lib/protocols/stun.c
parent65d526d8f6ae75f8d1a3f5c8dd19bf40ec03f320 (diff)
Code cleanup
Diffstat (limited to 'src/lib/protocols/stun.c')
-rw-r--r--src/lib/protocols/stun.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/protocols/stun.c b/src/lib/protocols/stun.c
index e95965f6b..d5114204f 100644
--- a/src/lib/protocols/stun.c
+++ b/src/lib/protocols/stun.c
@@ -350,9 +350,13 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
memset(flow->host_server_name, 0, sizeof(flow->host_server_name));
- for(j=0; j<i; j++)
- flow->host_server_name[j] = payload[k++];
-
+ for(j=0; j<i; j++) {
+ if((k+i) < payload_length)
+ flow->host_server_name[j] = payload[k++];
+ else
+ break;
+ }
+
#ifdef DEBUG_STUN
printf("==> [%s]\n", flow->host_server_name);
#endif