]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
kauth: Don't overflow cell string
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 2 Mar 2013 09:33:12 +0000 (09:33 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 3 Jun 2014 16:35:09 +0000 (12:35 -0400)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 77aa6c65b74e46c77dfaf440745496ab98b14244)

Change-Id: I7e0411ce635d481cf1618c2eabf79dfb85fcd069
Reviewed-on: http://gerrit.openafs.org/11037
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/kauth/knfs.c

index 6852e44a78fc081ddeb8adace89abee30e367b3c..08b0ef9315b0f73bc7e9c0cdcecfa9de9217431e 100644 (file)
@@ -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);