summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-07-07 23:14:44 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-07-07 23:14:44 +0000
commit73c821c369dfa82196600aeb8c3cf43437742cca (patch)
tree6b0a1ac28d79e69dea6c9a1f61cd9b44f5a47c65
parent8164b29951f52603c84f0e1450dd19c38f42ae2c (diff)
missing error checks on strdup. from cloder@acm.org
-rw-r--r--bin/systrace/intercept.c7
-rw-r--r--bin/systrace/policy.c5
2 files changed, 9 insertions, 3 deletions
diff --git a/bin/systrace/intercept.c b/bin/systrace/intercept.c
index 2564861025e..b799205b90e 100644
--- a/bin/systrace/intercept.c
+++ b/bin/systrace/intercept.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intercept.c,v 1.8 2002/06/28 00:26:29 deraadt Exp $ */
+/* $OpenBSD: intercept.c,v 1.9 2002/07/07 23:14:43 provos Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -603,8 +603,11 @@ intercept_child_info(pid_t opid, pid_t npid)
inpid = intercept_getpid(npid);
inpid->policynr = ipid->policynr;
- if (ipid->name != NULL)
+ if (ipid->name != NULL) {
inpid->name = strdup(ipid->name);
+ if (inpid->name == NULL)
+ err(1, "%s:%d: strdup", __func__, __LINE__);
+ }
/* XXX - keeps track of emulation */
intercept.clonepid(ipid, inpid);
diff --git a/bin/systrace/policy.c b/bin/systrace/policy.c
index 88a9676b9f9..00b65738cb6 100644
--- a/bin/systrace/policy.c
+++ b/bin/systrace/policy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: policy.c,v 1.11 2002/06/22 18:23:02 deraadt Exp $ */
+/* $OpenBSD: policy.c,v 1.12 2002/07/07 23:14:43 provos Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -460,6 +460,9 @@ systrace_readpolicy(char *filename)
err(1, "%s:%d: calloc", __func__, __LINE__);
filter->rule = strdup(rule);
+ if (filter->rule == NULL)
+ err(1, "%s:%d: strdup", __func__, __LINE__);
+
strlcpy(filter->name, name, sizeof(filter->name));
strlcpy(filter->emulation,emulation,sizeof(filter->emulation));