icu-65.1-initialized-buffer-uloc_getKeywordValue.patch 838 B

123456789101112131415161718192021222324
  1. From fab4c3c719977205a3f005ddfd7fffbb9c19c587 Mon Sep 17 00:00:00 2001
  2. From: Frank Tang <ftang@chromium.org>
  3. Date: Wed, 30 Oct 2019 17:45:22 -0700
  4. Subject: [PATCH] ICU-20884 initialized buffer uloc_getKeywordValue
  5. ---
  6. icu4c/source/common/uloc.cpp | 3 +++
  7. 1 file changed, 3 insertions(+)
  8. diff --git a/icu4c/source/common/uloc.cpp b/icu4c/source/common/uloc.cpp
  9. index 6a9bfcfbff5..ea81c0ce87f 100644
  10. --- a/icu4c/source/common/uloc.cpp
  11. +++ b/icu4c/source/common/uloc.cpp
  12. @@ -766,6 +766,9 @@ uloc_getKeywordValue(const char* localeID,
  13. char* buffer, int32_t bufferCapacity,
  14. UErrorCode* status)
  15. {
  16. + if (buffer != nullptr) {
  17. + buffer[0] = '\0';
  18. + }
  19. const char* startSearchHere = NULL;
  20. const char* nextSeparator = NULL;
  21. char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];