From: Simon Wilkinson Date: Mon, 16 Jul 2012 19:09:04 +0000 (+0100) Subject: auth: Fix GetTokenEx with NULL cellName X-Git-Tag: upstream/1.8.0_pre1^2~2175 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0eca3c1822683ccf1b559eb8e455688c5bdc1fc9;p=packages%2Fo%2Fopenafs.git auth: Fix GetTokenEx with NULL cellName If GetTokenEx is called with a NULL cellName, it means use the local cell. To do this with the legacy interface, a 0 length string must be used for the cell instance of the ktc_principal passed to GetToken. Fix this so that we do so, rather than attempting to strcpy(..., NULL) which never ends well. Caught by clang-analyzer Change-Id: I53d9bdf0fc280ee073a2fb7693659269df29c2eb Reviewed-on: http://gerrit.openafs.org/7840 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 036bb6a3d..fc2563674 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -487,7 +487,10 @@ ktc_GetTokenEx(char *cellName, struct ktc_setTokenData **tokenSet) { memset(ktcToken, 0, sizeof(struct ktc_token)); strcpy(server.name, "afs"); - strcpy(server.cell, cellName); + + if (cellName != NULL) + strcpy(server.cell, cellName); + code = GetToken(&server, ktcToken, sizeof(struct ktc_token), NULL /*client*/, &viceid); if (code == 0) {