diff options
author | 2021-02-08 19:05:05 +0000 | |
---|---|---|
committer | 2021-02-08 19:05:05 +0000 | |
commit | f1c55410fda2b0d125a0102e4c78ba4b89e335c2 (patch) | |
tree | 47b734caaaee14c1cf1060a6458deba90cb60db6 | |
parent | Update DTLS client hello due to ECC changes. (diff) | |
download | wireguard-openbsd-f1c55410fda2b0d125a0102e4c78ba4b89e335c2.tar.xz wireguard-openbsd-f1c55410fda2b0d125a0102e4c78ba4b89e335c2.zip |
Make bioctl properly verify raidlevels specified via the -c option.
Trailing characters in the option argument were ignored, such that
-cC1 (typo of -c1C) was interpreted as -cC instead of being rejected.
ok jsing@
-rw-r--r-- | sbin/bioctl/bioctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index 2d2146bb30f..58561e5f30f 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.146 2021/02/08 11:20:03 stsp Exp $ */ +/* $OpenBSD: bioctl.c,v 1.147 2021/02/08 19:05:05 stsp Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -133,6 +133,8 @@ main(int argc, char *argv[]) func |= BIOC_CREATERAID; if (strcmp(optarg, "1C") == 0) { cr_level = 0x1C; + } else if (strlen(optarg) != 1) { + errx(1, "Invalid RAID level"); } else if (isdigit((unsigned char)*optarg)) { cr_level = strtonum(optarg, 0, 10, &errstr); if (errstr != NULL) |