From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Sun, 24 Feb 2019 19:29:58 +0000 (-0800) Subject: ICU-20454 Fix comparison of keyPath with stackPack in uresbund.cpp X-Git-Tag: release-64-rc~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf16b12036f58b673406128ccb0e0c0f04e07f42;p=icu ICU-20454 Fix comparison of keyPath with stackPack in uresbund.cpp --- diff --git a/icu4c/source/common/uresbund.cpp b/icu4c/source/common/uresbund.cpp index 050746da697..45bb92b804d 100644 --- a/icu4c/source/common/uresbund.cpp +++ b/icu4c/source/common/uresbund.cpp @@ -1126,7 +1126,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r, UResourceDataEntry *dataEntry = mainRes->fData; char stackPath[URES_MAX_BUFFER_SIZE]; char *pathBuf = stackPath, *myPath = pathBuf; - if(uprv_strlen(keyPath) > URES_MAX_BUFFER_SIZE) { + if(uprv_strlen(keyPath) >= UPRV_LENGTHOF(stackPath)) { pathBuf = (char *)uprv_malloc((uprv_strlen(keyPath)+1)*sizeof(char)); if(pathBuf == NULL) { *status = U_MEMORY_ALLOCATION_ERROR;