]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
auth: check if argument of afsconf_Close* is null
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Mon, 1 Oct 2018 21:44:22 +0000 (17:44 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 21 Dec 2018 13:32:03 +0000 (08:32 -0500)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
(cherry picked from commit bd58bb85004a18bb6681ff2b0c13a04e23c4d9c4)

Change-Id: I6a99b559ab863c8485af9ec17c940b64cf844acf
Reviewed-on: https://gerrit.openafs.org/13372
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/auth/cellconfig.c

index 80b6e1e980988b727ee0f5cbe6ec2371b67de988..54d00d549cfaea7da3b11f7ad580ff45b6b93125 100644 (file)
@@ -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 */