diff options
author | Luca Deri <deri@ntop.org> | 2024-09-28 18:42:56 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2024-09-28 18:43:31 +0200 |
commit | 726bb6704ccdf247fc3ac4fc9802c17a15bed753 (patch) | |
tree | 88088d762475b6c34e88b95e4fe0125a277024d2 /src/lib/protocols/http.c | |
parent | e2ed23a72ae6027a52f7d92a0e96c56af8459600 (diff) |
Added check for avoiding heap buffer overflows
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r-- | src/lib/protocols/http.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 57f71e2fe..cb146fcc0 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -967,8 +967,9 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ } if(packet->upgrade_line.ptr != NULL) { - if(flow->http.response_status_code == 101 && - memcmp((char *)packet->upgrade_line.ptr, "websocket", 9) == 0) + if((flow->http.response_status_code == 101) + && (packet->upgrade_line.len >= 9) + && memcmp((char *)packet->upgrade_line.ptr, "websocket", 9) == 0) flow->http.websocket = 1; } |