From: Simon Wilkinson Date: Sun, 3 Mar 2013 17:47:49 +0000 (+0000) Subject: auth: Don't overflow lower case cell string X-Git-Tag: upstream/1.8.0_pre1^2~1320 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1c582768df98494775caf197da23612d59425509;p=packages%2Fo%2Fopenafs.git 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 --- 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) {