aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-12-03 21:35:12 +0100
committerHarald Welte <laforge@osmocom.org>2019-12-03 21:35:48 +0100
commit278a6c8fcfc04084cd459a990ad93077b2a9cab0 (patch)
treea2fdaf3365aa89dfbb47675fa4736fee38c0b77f
parentf7404bb4731be116185c1ee9aa6c8e9dd0a90663 (diff)
utils: exit(2) on unsupported positional arguments on command line
-rw-r--r--utils/osmo-arfcn.c5
-rw-r--r--utils/osmo-auc-gen.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/utils/osmo-arfcn.c b/utils/osmo-arfcn.c
index 50878423..5f138f8c 100644
--- a/utils/osmo-arfcn.c
+++ b/utils/osmo-arfcn.c
@@ -128,6 +128,11 @@ int main(int argc, char **argv)
}
}
+ if (argc > optind) {
+ fprintf(stderr, "Unsupported positional arguments in command line\n");
+ exit(2);
+ }
+
switch (mode) {
case MODE_NONE:
help(argv[0]);
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index ec9bad88..65cfa310 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -247,6 +247,11 @@ int main(int argc, char **argv)
}
}
+ if (argc > optind) {
+ fprintf(stderr, "Unsupported positional arguments in command line\n");
+ exit(2);
+ }
+
if (!rand_is_set) {
rc = osmo_get_rand_id(_rand, 16);
if (rc < 0) {