afscp: avoid null dereference in _GetSecurityObject error case
authorGarrett Wollman <wollman@csail.mit.edu>
Sat, 28 Jul 2012 04:18:00 +0000 (00:18 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 28 Jul 2012 05:25:00 +0000 (22:25 -0700)
Handle the possible error return from krb5_get_host_realm in the
same way as the other error cases (using an anonymous security
object); otherwise "realm" would be left null.

Change-Id: I5ce7a614a3e272b3a9903a8e95545a8116d1af3c
Reviewed-on: http://gerrit.openafs.org/7891
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/libafscp/afscp_util.c

index cb96a6b..df4689a 100644 (file)
@@ -139,7 +139,8 @@ _GetSecurityObject(struct afscp_cell *cell)
            strlcpy(localcell, realms[0], sizeof(localcell));
            krb5_free_host_realm(context, realms);
            realm = localcell;
-       }
+       } else
+           goto try_anon;
     } else {
        realm = cell->realm;
        strlcpy(localcell, realm, MAXCELLCHARS + 1);