diff options
author | ume <ume@FreeBSD.org> | 2000-12-04 13:38:59 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2000-12-04 13:38:59 +0000 |
commit | 77dd285b0401334ee7129e0271e74019309c7609 (patch) | |
tree | 02d37861f5694b31648c962cbf1e8928f42123c4 /sbin | |
parent | d511c47ae91f13e32c3f5aee72471fe47bca2fbf (diff) | |
download | FreeBSD-src-77dd285b0401334ee7129e0271e74019309c7609.zip FreeBSD-src-77dd285b0401334ee7129e0271e74019309c7609.tar.gz |
test strdup() failures.
from: Chris Faulhaber <jedgar@fxp.org>
Obtained from: KAME
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ping6/ping6.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index f853534..3d529b6 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -444,11 +444,13 @@ main(argc, argv) #ifdef IPSEC_POLICY_IPSEC case 'P': options |= F_POLICY; - if (!strncmp("in", optarg, 2)) - policy_in = strdup(optarg); - else if (!strncmp("out", optarg, 3)) - policy_out = strdup(optarg); - else + if (!strncmp("in", optarg, 2)) { + if ((policy_in = strdup(optarg)) == NULL) + errx(1, "strdup"); + } else if (!strncmp("out", optarg, 3)) { + if ((policy_out = strdup(optarg)) == NULL) + errx(1, "strdup"); + } else errx(1, "invalid security policy"); break; #else |