diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-08-01 06:19:28 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-08-01 06:19:28 +0000 |
commit | fa277537e165b151691dccdc8c76d2b31d448851 (patch) | |
tree | 69aa222dc02149f9b37c5ebd61175617cf43c612 /sbin | |
parent | 4c98bb9a9fe04e29632ba2a981f10b791586f9ee (diff) |
Sanity check numerical values for -proto/-proto2 flags (4, 50, and 51
accepted only).
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ipsec/ipsecadm/ipsecadm.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sbin/ipsec/ipsecadm/ipsecadm.c b/sbin/ipsec/ipsecadm/ipsecadm.c index 41ac468ab43..33d6e791523 100644 --- a/sbin/ipsec/ipsecadm/ipsecadm.c +++ b/sbin/ipsec/ipsecadm/ipsecadm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsecadm.c,v 1.19 1998/08/01 06:17:15 angelos Exp $ */ +/* $OpenBSD: ipsecadm.c,v 1.20 1998/08/01 06:19:27 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -359,8 +359,14 @@ main(argc, argv) fprintf(stderr, "%s: unknown security protocol type %s\n", argv[0], argv[i+1]); exit(1); } - } else + } else { proto = atoi(argv[i+1]); + if (proto != IPPROTO_ESP && proto != IPPROTO_AH && + proto != IPPROTO_IPIP) { + fprintf(stderr, "%s: unknown security protocol %d\n", argv[0], proto); + exit(1); + } + } i++; } else if (!strcmp(argv[i]+1, "proto2") && iscmd(mode, GRP_SPI) && i+1 < argc) { @@ -377,6 +383,11 @@ main(argc, argv) } } else proto2 = atoi(argv[i+1]); + if (proto2 != IPPROTO_ESP && proto2 != IPPROTO_AH && + proto2 != IPPROTO_IPIP) { + fprintf(stderr, "%s: unknown security protocol %d\n", argv[0], proto); + exit(1); + } i++; } else if (!strcmp(argv[i]+1, "chain") && chain == 0 && iscmd(mode, DEL_SPI)) { |