From: Abhinav Gupta Date: Thu, 15 Sep 2011 18:09:30 +0000 (+0000) Subject: ICU-8813 removed name from stack buffer in init_entry (uresbound.cpp) X-Git-Tag: milestone-59-0-1~4518 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f67841a40d70626dcf69c0d02000315177b38690;p=icu ICU-8813 removed name from stack buffer in init_entry (uresbound.cpp) X-SVN-Rev: 30664 --- diff --git a/icu4c/source/common/uresbund.cpp b/icu4c/source/common/uresbund.cpp index cf1b2a55b85..4f694748820 100644 --- a/icu4c/source/common/uresbund.cpp +++ b/icu4c/source/common/uresbund.cpp @@ -290,7 +290,7 @@ static void initCache(UErrorCode *status) { /** INTERNAL: sets the name (locale) of the resource bundle to given name */ -static void setEntryName(UResourceDataEntry *res, char *name, UErrorCode *status) { +static void setEntryName(UResourceDataEntry *res, const char *name, UErrorCode *status) { int32_t len = (int32_t)uprv_strlen(name); if(res->fName != NULL && res->fName != res->fNameBuffer) { uprv_free(res->fName); @@ -319,7 +319,7 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE UResourceDataEntry *r = NULL; UResourceDataEntry find; /*int32_t hashValue;*/ - char name[ULOC_FULLNAME_CAPACITY]; + const char *name; char aliasName[100] = { 0 }; int32_t aliasLen = 0; /*UBool isAlias = FALSE;*/ @@ -331,15 +331,14 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE /* here we try to deduce the right locale name */ if(localeID == NULL) { /* if localeID is NULL, we're trying to open default locale */ - uprv_strcpy(name, uloc_getDefault()); + name = uloc_getDefault(); } else if(*localeID == 0) { /* if localeID is "" then we try to open root locale */ - uprv_strcpy(name, kRootLocaleName); + name = kRootLocaleName; } else { /* otherwise, we'll open what we're given */ - uprv_strncpy(name, localeID, sizeof(name) - 1); - name[sizeof(name) - 1] = 0; + name = localeID; } - find.fName = name; + find.fName = (char *)name; find.fPath = (char *)path; /* calculate the hash value of the entry */