]> granicus.if.org Git - icu/commitdiff
ICU-20454 Fix comparison of keyPath with stackPack in uresbund.cpp
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Sun, 24 Feb 2019 19:29:58 +0000 (11:29 -0800)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Wed, 27 Feb 2019 21:31:32 +0000 (13:31 -0800)
icu4c/source/common/uresbund.cpp

index 050746da69773da1f225f616b50f416eb7446354..45bb92b804de102d2d2531d410936261f48b4f9c 100644 (file)
@@ -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;