From: mestre Date: Wed, 1 Aug 2018 17:17:42 +0000 (+0000) Subject: Fix segmentation fault on radiusd(8) when exiting. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fda17215ec9c0adb23d4fc9c243464325b9e9d52;p=openbsd Fix segmentation fault on radiusd(8) when exiting. If one of the configured modules doesn't have a secret setup then module->secret == NULL which would call strlen(NULL), within freezero(3), and that shouldn't happen, but in this case since the call is done it segfaults and the daemon is not properly shutdown. cluebat stick provided by semarie@, OK tb@ and deraadt@ --- diff --git a/usr.sbin/radiusd/radiusd.c b/usr.sbin/radiusd/radiusd.c index 3db129b0cf5..bd61bb6a4bd 100644 --- a/usr.sbin/radiusd/radiusd.c +++ b/usr.sbin/radiusd/radiusd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd.c,v 1.20 2017/06/13 05:40:22 yasuoka Exp $ */ +/* $OpenBSD: radiusd.c,v 1.21 2018/08/01 17:17:42 mestre Exp $ */ /* * Copyright (c) 2013 Internet Initiative Japan Inc. @@ -1066,8 +1066,10 @@ radiusd_module_stop(struct radiusd_module *module) { module->stopped = true; - freezero(module->secret, strlen(module->secret)); - module->secret = NULL; + if (module->secret != NULL) { + freezero(module->secret, strlen(module->secret)); + module->secret = NULL; + } if (module->fd >= 0) { imsg_compose(&module->ibuf, IMSG_RADIUSD_MODULE_STOP, 0, 0, -1,