Skip to content

Commit

Permalink
Checkerlib: raise exception on oversized flagids
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rudis committed Sep 9, 2024
1 parent 2aacc70 commit 174ff92
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ctf_gameserver/checkerlib/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 174ff92

Please sign in to comment.