From: Simon Wilkinson Date: Sat, 2 Mar 2013 09:33:12 +0000 (+0000) Subject: kauth: Don't overflow cell string X-Git-Tag: upstream/1.6.10_pre1^2~152 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e511a4069e30ecf14375f58380972b17b04e0fc2;p=packages%2Fo%2Fopenafs.git kauth: Don't overflow cell string The cell string within a ktc_principal is only 64 characters long. Be careful not to overflow it. Caught by coverity (#985829) Reviewed-on: http://gerrit.openafs.org/9350 Tested-by: BuildBot Reviewed-by: Jeffrey Altman (cherry picked from commit 77aa6c65b74e46c77dfaf440745496ab98b14244) Change-Id: I7e0411ce635d481cf1618c2eabf79dfb85fcd069 Reviewed-on: http://gerrit.openafs.org/11037 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Stephan Wiesand --- diff --git a/src/kauth/knfs.c b/src/kauth/knfs.c index 6852e44a7..08b0ef931 100644 --- a/src/kauth/knfs.c +++ b/src/kauth/knfs.c @@ -190,7 +190,7 @@ GetTokens(afs_int32 ahost, afs_int32 auid) sprintf(clientName.name, "Unix UID %d", ct.ViceId); clientName.instance[0] = 0; } - strcpy(clientName.cell, tp); + strlcpy(clientName.cell, tp, sizeof(clientName.cell)); tokenExpireTime = token.endTime; strcpy(UserName, clientName.name);