From 72365c5bb389193deb149ee3d9c7a4f6eacbde5d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 23 Dec 2023 15:12:24 +0000 Subject: [PATCH] Initialise buffers --- src/grib_accessor_class_message_copy.cc | 1 + src/grib_expression_class_string_compare.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/grib_accessor_class_message_copy.cc b/src/grib_accessor_class_message_copy.cc index 4b3df8857..30806b163 100644 --- a/src/grib_accessor_class_message_copy.cc +++ b/src/grib_accessor_class_message_copy.cc @@ -133,6 +133,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) if (v[i] > 126) v[i] = 32; memcpy(val, grib_handle_of_accessor(a)->buffer->data, slen); + val[i] = 0; *len = slen; diff --git a/src/grib_expression_class_string_compare.cc b/src/grib_expression_class_string_compare.cc index 8ee196c2e..1c6202b23 100644 --- a/src/grib_expression_class_string_compare.cc +++ b/src/grib_expression_class_string_compare.cc @@ -100,9 +100,9 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) { int ret = 0; - char b1[1024]; + char b1[1024] = {0,}; size_t l1 = sizeof(b1); - char b2[1024]; + char b2[1024] = {0,}; size_t l2 = sizeof(b2); const char* v1 = NULL; const char* v2 = NULL;