diff --git a/cde/lib/DtSvc/DtUtil2/XlationSvc.c b/cde/lib/DtSvc/DtUtil2/XlationSvc.c index a7298c0ac..c36f97dee 100644 --- a/cde/lib/DtSvc/DtUtil2/XlationSvc.c +++ b/cde/lib/DtSvc/DtUtil2/XlationSvc.c @@ -2199,18 +2199,15 @@ int _DtXlateGetXlateEnv( /* then look up version number of execution host */ if (ret_AppExecEnvVersion) { -#if defined(sun) || defined(_AIX) || defined(__linux__) || defined(CSRG_BASED) - char version[SYS_NMLN+SYS_NMLN+2]; -#else - char version[UTSLEN+UTSLEN+2]; -#endif + char version[sizeof(names.release)+sizeof(names.version)-1]; char * stdVer = NULL; int verNum = MATCHALL_VER; /* cat release version and do a translation on it to a std value */ /* then convert the std value to a integer */ - strcpy(version,names.release); - strcat(version,names.version); + strncpy(version,names.release,sizeof(names.release)-1); + version[sizeof(names.release)-1] = EOS; + strncat(version,names.version,sizeof(names.version)-1); ret = _DtXlateOpToStdValue(db,names.sysname,0, _DtXLATE_OPER_VERSION,version,&stdVer,NULL); if (ret == 0) diff --git a/cde/lib/DtSvc/DtUtil2/XlationSvc.h b/cde/lib/DtSvc/DtUtil2/XlationSvc.h index ab2763e59..4cbf865ba 100644 --- a/cde/lib/DtSvc/DtUtil2/XlationSvc.h +++ b/cde/lib/DtSvc/DtUtil2/XlationSvc.h @@ -109,14 +109,15 @@ platforms as part of a translation. /*================================================$SKIP$==*/ #endif /* $DEF$, Platform constants */ -#if defined(SVR4) || defined(_AIX) +#if defined(SVR4) || defined(_AIX) || defined(SYS_NMLN) #define _DtPLATFORM_MAX_LEN SYS_NMLN -#else -#if defined(SYS_NMLN) -#define _DtPLATFORM_MAX_LEN SYS_NMLN -#else +#elif defined(UTSLEN) #define _DtPLATFORM_MAX_LEN UTSLEN -#endif +#else +/* POSIX guarantees that hostnames are limited to 255 bytes, + * but SVR4 platforms commonly allow for 256. + */ +#define _DtPLATFORM_MAX_LEN 257 #endif #define _DtPLATFORM_UNKNOWN ((const char *)0)