From 174ff9289b4936abd48a3da35705a42bfe907bdf Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 9 Sep 2024 08:30:15 +0200 Subject: [PATCH] Checkerlib: raise exception on oversized flagids Otherwise using a longer flagid raises a psycopg2 exception which gets treated as communication error. This terminates the checker script without making this visible to the service author. --- src/ctf_gameserver/checkerlib/lib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ctf_gameserver/checkerlib/lib.py b/src/ctf_gameserver/checkerlib/lib.py index b66b7f8..d160a2f 100644 --- a/src/ctf_gameserver/checkerlib/lib.py +++ b/src/ctf_gameserver/checkerlib/lib.py @@ -145,6 +145,8 @@ def set_flagid(data: str) -> None: if not isinstance(data, str): raise TypeError('data must be of type str') + if len(data) > 200: + raise AttributeError('data must not be longer than 200 bytes') if not _launched_without_runner(): _send_ctrl_message({'action': 'FLAGID', 'param': data})