summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-09 13:05:43 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-09 13:05:43 +0000
commitc9409f68a4508c9914d98f17c662a2668d58fbbe (patch)
tree30dccb372ea71ae5f4d336a180ef595a5fcbe3de /usr.sbin/hoststated
parent21cccc0bcca7cb984d889e4c3e034069d14d7e6d (diff)
fix potential NULL deref.
spotted by Ching-Feng Wang <cfw at telepaq.com>. ok reyk@
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r--usr.sbin/hoststated/pfe.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/hoststated/pfe.c b/usr.sbin/hoststated/pfe.c
index bdd57ed623e..08efe112411 100644
--- a/usr.sbin/hoststated/pfe.c
+++ b/usr.sbin/hoststated/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.20 2007/03/17 22:46:41 reyk Exp $ */
+/* $OpenBSD: pfe.c,v 1.21 2007/05/09 13:05:42 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -446,9 +446,9 @@ disable_service(struct ctl_conn *c, struct ctl_id *id)
service = service_findbyname(env, id->name);
else
service = service_find(env, id->id);
- id->id = service->id;
if (service == NULL)
return (-1);
+ id->id = service->id;
if (service->flags & F_DISABLE)
return (0);
@@ -472,9 +472,9 @@ enable_service(struct ctl_conn *c, struct ctl_id *id)
service = service_findbyname(env, id->name);
else
service = service_find(env, id->id);
- id->id = service->id;
if (service == NULL)
return (-1);
+ id->id = service->id;
if (!(service->flags & F_DISABLE))
return (0);
@@ -509,9 +509,9 @@ disable_table(struct ctl_conn *c, struct ctl_id *id)
table = table_findbyname(env, id->name);
else
table = table_find(env, id->id);
- id->id = table->id;
if (table == NULL)
return (-1);
+ id->id = table->id;
if ((service = service_find(env, table->serviceid)) == NULL)
fatalx("disable_table: desynchronised");
@@ -539,9 +539,9 @@ enable_table(struct ctl_conn *c, struct ctl_id *id)
table = table_findbyname(env, id->name);
else
table = table_find(env, id->id);
- id->id = table->id;
if (table == NULL)
return (-1);
+ id->id = table->id;
if ((service = service_find(env, table->serviceid)) == NULL)
fatalx("enable_table: desynchronised");
@@ -571,9 +571,9 @@ disable_host(struct ctl_conn *c, struct ctl_id *id)
host = host_findbyname(env, id->name);
else
host = host_find(env, id->id);
- id->id = host->id;
if (host == NULL)
return (-1);
+ id->id = host->id;
if (host->flags & F_DISABLE)
return (0);
@@ -613,9 +613,9 @@ enable_host(struct ctl_conn *c, struct ctl_id *id)
host = host_findbyname(env, id->name);
else
host = host_find(env, id->id);
- id->id = host->id;
if (host == NULL)
return (-1);
+ id->id = host->id;
if (!(host->flags & F_DISABLE))
return (0);