From: Marcio Barbosa Date: Mon, 1 Oct 2018 21:44:22 +0000 (-0400) Subject: auth: check if argument of afsconf_Close* is null X-Git-Tag: upstream/1.8.3^2~17 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=bf4d7ed224738b7e04b236e2d515770b6c7f8c40;p=packages%2Fo%2Fopenafs.git auth: check if argument of afsconf_Close* is null Currently, we do not check if the argument of afsconf_Close / afsconf_CloseInternal is equal to null. In order to avoid a possible segmentation fault, add the checks. Reviewed-on: https://gerrit.openafs.org/13352 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Michael Meffie (cherry picked from commit bd58bb85004a18bb6681ff2b0c13a04e23c4d9c4) Change-Id: I6a99b559ab863c8485af9ec17c940b64cf844acf Reviewed-on: https://gerrit.openafs.org/13372 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/auth/cellconfig.c b/src/auth/cellconfig.c index 80b6e1e98..54d00d549 100644 --- a/src/auth/cellconfig.c +++ b/src/auth/cellconfig.c @@ -1542,6 +1542,10 @@ afsconf_GetLocalCell(struct afsconf_dir *adir, char *aname, afs_int32 alen) int afsconf_Close(struct afsconf_dir *adir) { + if (adir == NULL) { + return 0; + } + LOCK_GLOBAL_MUTEX; afsconf_CloseInternal(adir); if (adir->name) @@ -1558,6 +1562,10 @@ afsconf_CloseInternal(struct afsconf_dir *adir) struct afsconf_aliasentry *ta, *na; char *tname; + if (adir == NULL) { + return 0; + } + tname = adir->name; /* remember name, since that's all we preserve */ /* free everything we can find */