changeset 50:f77a48a01ff0

trau-parse command line: parse -r more robustly
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 24 Sep 2024 19:54:12 +0000
parents e579784e5578
children 4189abdfeaa4
files trau-decode/parse-main.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/trau-decode/parse-main.c	Tue Sep 24 19:49:45 2024 +0000
+++ b/trau-decode/parse-main.c	Tue Sep 24 19:54:12 2024 +0000
@@ -366,6 +366,8 @@
 
 	switch (argc) {
 	case 3:
+		if (argv[1][0] == '-')
+			goto usage;
 		filename = argv[1];
 		subslot_arg = argv[2];
 		include_raw = 0;
@@ -373,6 +375,8 @@
 	case 4:
 		if (strcmp(argv[1], "-r"))
 			goto usage;
+		if (argv[2][0] == '-')
+			goto usage;
 		filename = argv[2];
 		subslot_arg = argv[3];
 		include_raw = 1;