From 482f0379b584493e3affe440c7de7d5c43cd841c Mon Sep 17 00:00:00 2001 From: fordprefect Date: Fri, 8 Jan 2021 16:41:23 +0100 Subject: [PATCH] exit on overlong passed data --- pin.run | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pin.run b/pin.run index 19edde8..556deb0 100755 --- a/pin.run +++ b/pin.run @@ -30,6 +30,13 @@ if os.path.getsize(database) < 100 * 1024 * 1024: # only add entries if file size does not exceed 100 MiB if "ort" in args and "name" in args and "comment" in args: + + # fail if input is too long + if max(map(len, list(args[i] for i in args))) > 200: + # overlong input is a clear indication someone is fiddling with the interface + # this deserves no proper exit message + exit() + # add entry try: zeit = datetime.timestamp(datetime(int(args["year"]), int(args["month"]), int(args["day"]), int(args["hour"]), int(args["minute"])))