diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2012-05-08 13:30:17 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2012-05-08 13:30:17 +0000 |
commit | 282fbf89fd60d4cf1da6adac18888b8c950d8419 (patch) | |
tree | 01fc99bc2913de08b714c3fc69612d6da2714a85 | |
parent | 752dc8b92fc090361b9a21583b29d19cfb8f9350 (diff) |
Fix a null reference bug on terminating the process.
seems ok henning, ok mcbride
-rw-r--r-- | usr.sbin/npppd/npppd/npppd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/npppd/npppd/npppd.c b/usr.sbin/npppd/npppd/npppd.c index f6128441d77..a9fa87e578d 100644 --- a/usr.sbin/npppd/npppd/npppd.c +++ b/usr.sbin/npppd/npppd/npppd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppd.c,v 1.17 2012/05/08 13:18:37 yasuoka Exp $ */ +/* $OpenBSD: npppd.c,v 1.18 2012/05/08 13:30:16 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -29,7 +29,7 @@ * Next pppd(nppd). This file provides a npppd daemon process and operations * for npppd instance. * @author Yasuoka Masahiko - * $Id: npppd.c,v 1.17 2012/05/08 13:18:37 yasuoka Exp $ + * $Id: npppd.c,v 1.18 2012/05/08 13:30:16 yasuoka Exp $ */ #include <sys/cdefs.h> #include "version.h" @@ -1774,7 +1774,8 @@ npppd_set_radish(npppd *_this, void *radish_head) if (_this->rd != NULL) npppd_rd_walktree_delete(_this->rd); - _this->rd = radish_head; + if (radish_head == NULL) + npppd_get_all_users(_this, &delppp); for (slist_itr_first(&delppp); slist_itr_has_next(&delppp);) { ppp = slist_itr_next(&delppp); @@ -1784,6 +1785,7 @@ npppd_set_radish(npppd *_this, void *radish_head) ppp_stop(ppp, NULL); } slist_fini(&delppp); + _this->rd = radish_head; return 0; fail: @@ -1809,6 +1811,8 @@ npppd_get_all_users(npppd *_this, slist *users) NPPPD_ASSERT(_this != NULL); slist_init(&list); + if (_this->rd == NULL) + return 0; rval = rd2slist(_this->rd, &list); if (rval != 0) return rval; |