From 1c582768df98494775caf197da23612d59425509 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 3 Mar 2013 17:47:49 +0000 Subject: [PATCH] auth: Don't overflow lower case cell string When building tcell_l in kerberosSuperUser, make sure that we don't overflow the string that we're constructing. Use the opr_lcstring function to do the lower case conversion, rather than rolling our own. Caught by coverity (#985772) Change-Id: I6e28cfc54883aac7e3a3eb2f4e2b2bf7ebc0bc63 Reviewed-on: http://gerrit.openafs.org/9544 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- src/auth/userok.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/auth/userok.c b/src/auth/userok.c index f66acf1df..ff88fc42d 100644 --- a/src/auth/userok.c +++ b/src/auth/userok.c @@ -597,20 +597,13 @@ kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst, char *tcell, struct rx_identity **identity) { char tcell_l[MAXKTCREALMLEN] = ""; - char *tmp; int code; afs_int32 islocal; int flag; /* generate lowercased version of cell name */ - if (tcell) { - strcpy(tcell_l, tcell); - tmp = tcell_l; - while (*tmp) { - *tmp = tolower(*tmp); - tmp++; - } - } + if (tcell) + opr_lcstring(tcell_l, tcell, sizeof(tcell_l)); code = afsconf_IsLocalRealmMatch(adir, &islocal, tname, tinst, tcell); if (code) { -- 2.39.5