aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-12-03 22:14:20 +0100
committerHarald Welte <laforge@osmocom.org>2019-12-04 12:08:33 +0100
commitcbf23b646552e36ed0b085197477c2d9c7b575ac (patch)
treee051d0d504f1175432778440011b6fec7935284c /src
parent50595fb9b5028167c150e4125e813dcd56ee6163 (diff)
exit(2) on unsupported positional arguments on command line
Diffstat (limited to 'src')
-rw-r--r--src/e1_recorder.c5
-rw-r--r--src/e1cap_dump.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/e1_recorder.c b/src/e1_recorder.c
index 9110ccb..d085ca5 100644
--- a/src/e1_recorder.c
+++ b/src/e1_recorder.c
@@ -123,6 +123,11 @@ static void handle_options(int argc, char **argv)
break;
}
}
+
+ if (argc > optind) {
+ fprintf(stderr, "Unsupported positional arguments on command line\n");
+ exit(2);
+ }
}
int main(int argc, char **argv)
diff --git a/src/e1cap_dump.c b/src/e1cap_dump.c
index c172b55..73be84b 100644
--- a/src/e1cap_dump.c
+++ b/src/e1cap_dump.c
@@ -275,6 +275,11 @@ int main(int argc, char **argv)
exit(2);
}
+ if (argc > optind+1) {
+ fprintf(stderr, "Unsupported positional arguments on command line\n");
+ exit(2);
+ }
+
f = osmo_e1cap_open(NULL, argv[optind++]);
if (!f) {
fprintf(stderr, "Unable to open input file\n");