From 739295e8659779fe4831cd66aef4a4292090a543 Mon Sep 17 00:00:00 2001 From: mstrypst Date: Wed, 23 Oct 2024 14:10:35 +0200 Subject: [PATCH] Limit sender username --- chat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chat.py b/chat.py index 17c3ceb..c0c0e60 100644 --- a/chat.py +++ b/chat.py @@ -105,6 +105,8 @@ def messages_post(): if "X-Username" in request.headers and len(request.headers["X-Username"]) > 0: sender = request.headers["X-Username"] sendertype = "name" + if len(sender) > 50: + return "Username too long" elif "X-Real-IP" in request.headers: sender = reverse_lookup(request.headers["X-Real-IP"]) sendertype = "ip"