From da401ba7b83c74297b50d022e5fb38f2c1bd3b49 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 5 Dec 2022 13:47:16 +0000 Subject: [PATCH] ECC-1488: Fortran: Bug in grib_f_get_error_string --- fortran/grib_fortran.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index 257260185..f8a3fc08a 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -2170,10 +2170,10 @@ int grib_f_print_(int* gid, char* key, int len){ } } int grib_f_print__(int* gid, char* key, int len){ - return grib_f_print_( gid, key, len); + return grib_f_print_(gid, key, len); } int grib_f_print(int* gid, char* key, int len){ - return grib_f_print_( gid, key, len); + return grib_f_print_(gid, key, len); } /*****************************************************************************/ @@ -2181,14 +2181,14 @@ int grib_f_get_error_string_(int* err, char* buf, int len){ const char* err_msg = grib_get_error_message(*err); const size_t erlen = strlen(err_msg); if( len < erlen) return GRIB_ARRAY_TOO_SMALL; - strncpy(buf, err_msg,(size_t)len); + strncpy(buf, err_msg, (size_t)erlen); /* ECC-1488 */ return GRIB_SUCCESS; } -int grib_f_get_error_string__(int* err, char* buf, int len){ - return grib_f_get_error_string_(err,buf,len); +int grib_f_get_error_string__(int* err, char* buf, int len){ + return grib_f_get_error_string_(err, buf, len); } -int grib_f_get_error_string(int* err, char* buf, int len){ - return grib_f_get_error_string_(err,buf,len); +int grib_f_get_error_string(int* err, char* buf, int len){ + return grib_f_get_error_string_(err, buf, len); } /*****************************************************************************/