ICU-20884 initialized buffer uloc_getKeywordValue
diff --git a/icu4c/source/common/uloc.cpp b/icu4c/source/common/uloc.cpp
index 6a9bfcf..ea81c0c 100644
--- a/icu4c/source/common/uloc.cpp
+++ b/icu4c/source/common/uloc.cpp
@@ -766,6 +766,9 @@ uloc_getKeywordValue(const char* localeID,
char* buffer, int32_t bufferCapacity,
UErrorCode* status)
{
+ if (buffer != nullptr) {
+ buffer[0] = '\0';
+ }
const char* startSearchHere = NULL;
const char* nextSeparator = NULL;
char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];