From 80faa5e93ddc95ca676aa31f5d3522ad6b67f67e Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 23 Feb 2009 14:28:32 +0000 Subject: [PATCH] windows-getrootcellname-20090223 LICENSE MIT do not mix and match CELL_MAXNAMELEN and MAXCELLCHARS. They are not the same. --- src/WINNT/afsd/afskfw.c | 2 +- src/WINNT/afsd/cm_config.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsd/afskfw.c b/src/WINNT/afsd/afskfw.c index f0b024f823..7653574fbd 100644 --- a/src/WINNT/afsd/afskfw.c +++ b/src/WINNT/afsd/afskfw.c @@ -447,7 +447,7 @@ KFW_initialize(void) LoadFuncs(CCAPI_DLL, ccapi_fi, &hCCAPI, 0, 1, 0, 0); if ( KFW_is_available() ) { - char rootcell[MAXCELLCHARS+1]; + char rootcell[CELL_MAXNAMELEN+1]; #ifdef USE_MS2MIT KFW_import_windows_lsa(); #endif /* USE_MS2MIT */ diff --git a/src/WINNT/afsd/cm_config.c b/src/WINNT/afsd/cm_config.c index b15f9738dc..c153066b5d 100644 --- a/src/WINNT/afsd/cm_config.c +++ b/src/WINNT/afsd/cm_config.c @@ -394,7 +394,10 @@ long cm_GetCellServDB(char *cellNamep, afs_uint32 len) return 0; } -/* look up the root cell's name in the Registry */ +/* look up the root cell's name in the Registry + * Input buffer must be at least CELL_MAXNAMELEN + * in size. (Defined in cm_cell.h) + */ long cm_GetRootCellName(char *cellNamep) { DWORD code, dummyLen; @@ -405,7 +408,7 @@ long cm_GetRootCellName(char *cellNamep) if (code != ERROR_SUCCESS) return -1; - dummyLen = 256; + dummyLen = CELL_MAXNAMELEN; code = RegQueryValueEx(parmKey, "Cell", NULL, NULL, cellNamep, &dummyLen); RegCloseKey (parmKey);