From 3eed74e1ef5bf09f4d54bc7f0fc79d68bd713da0 Mon Sep 17 00:00:00 2001 From: Axel Svensson Date: Mon, 3 Jun 2024 10:51:13 +0200 Subject: [PATCH] Refuse to operate on files with dash prefix Fixes #6. --- pdf-sign | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pdf-sign b/pdf-sign index 5eb3199..56d2a36 100755 --- a/pdf-sign +++ b/pdf-sign @@ -19,6 +19,9 @@ def main(args): filePath=args.input if not isPdfFilename(filePath): die("Input file must end with .pdf (case insensitive)") + if filePath.startswith('-'): + # A cheap solution to a rare problem + die("Input file may not start with a dash (-)") with tempfile.TemporaryDirectory() as tempdir: intmp=lambda fileName: Volatile(os.path.join(tempdir, fileName)) # Maybe flatten (make forms non-editable) before signing