From 0eca3c1822683ccf1b559eb8e455688c5bdc1fc9 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 16 Jul 2012 20:09:04 +0100 Subject: [PATCH] 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 --- src/auth/ktc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 036bb6a..fc25636 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) { -- 1.9.4