From cac7bcda084879a876d93eb0480c2f7c76c25a4a Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Sat, 28 Jul 2012 00:18:00 -0400 Subject: [PATCH] afscp: avoid null dereference in _GetSecurityObject error case 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 Reviewed-by: Jeffrey Altman --- src/libafscp/afscp_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libafscp/afscp_util.c b/src/libafscp/afscp_util.c index cb96a6b69..df4689ae8 100644 --- a/src/libafscp/afscp_util.c +++ b/src/libafscp/afscp_util.c @@ -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); -- 2.39.5