From aaf513ff55ef787537504a25fd78d05656e5f349 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 24 Feb 2021 17:04:34 +0000 Subject: [PATCH] Compiler warnings: -Wformat-overflow --- ..._accessor_class_bufr_extract_datetime_subsets.c | 14 +++++++------- src/grib_index.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/grib_accessor_class_bufr_extract_datetime_subsets.c b/src/grib_accessor_class_bufr_extract_datetime_subsets.c index 6ecbf799e..593177015 100644 --- a/src/grib_accessor_class_bufr_extract_datetime_subsets.c +++ b/src/grib_accessor_class_bufr_extract_datetime_subsets.c @@ -205,7 +205,7 @@ static int build_long_array(grib_context* c, grib_handle* h, int compressed, } else { /* uncompressed */ - char keystr[20] = {0,}; + char keystr[32] = {0,}; size_t values_len = 0; for (i = 0; i < numberOfSubsets; ++i) { long lVal = 0; @@ -243,12 +243,12 @@ static int select_datetime(grib_accessor* a) grib_iarray* subsets; long* subsets_ar = 0; size_t nsubsets = 0; - char yearstr[20] = "year"; - char monthstr[20] = "month"; - char daystr[20] = "day"; - char hourstr[20] = "hour"; - char minutestr[20] = "minute"; - char secondstr[20] = "second"; + char yearstr[32] = "year"; + char monthstr[32] = "month"; + char daystr[32] = "day"; + char hourstr[32] = "hour"; + char minutestr[32] = "minute"; + char secondstr[32] = "second"; ret = grib_get_long(h, "compressedData", &compressed); if (ret) diff --git a/src/grib_index.c b/src/grib_index.c index 2d2d65514..216b3a3b1 100644 --- a/src/grib_index.c +++ b/src/grib_index.c @@ -997,8 +997,8 @@ grib_index* grib_index_read(grib_context* c, const char* filename, int* err) int grib_index_search_same(grib_index* index, grib_handle* h) { int err = 0; - char buf[1024] = {0,}; - size_t buflen = 1024; + char buf[STRING_VALUE_LEN] = {0,}; + size_t buflen = STRING_VALUE_LEN; grib_index_key* keys; long lval = 0; double dval = 0.0; @@ -1016,7 +1016,7 @@ int grib_index_search_same(grib_index* index, grib_handle* h) if (err) keys->type = GRIB_TYPE_STRING; } - buflen = 1024; + buflen = STRING_VALUE_LEN; switch (keys->type) { case GRIB_TYPE_STRING: err = grib_get_string(h, keys->name, buf, &buflen);