summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2000-12-04 13:38:59 +0000
committerume <ume@FreeBSD.org>2000-12-04 13:38:59 +0000
commit77dd285b0401334ee7129e0271e74019309c7609 (patch)
tree02d37861f5694b31648c962cbf1e8928f42123c4 /sbin
parentd511c47ae91f13e32c3f5aee72471fe47bca2fbf (diff)
downloadFreeBSD-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.c12
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
OpenPOWER on IntegriCloud