ECC-1488: Fortran: Bug in grib_f_get_error_string

This commit is contained in:
Shahram Najm 2022-12-05 13:47:16 +00:00
parent d0b4506010
commit da401ba7b8
1 changed files with 7 additions and 7 deletions

View File

@ -2170,10 +2170,10 @@ int grib_f_print_(int* gid, char* key, int len){
} }
} }
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){ 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 char* err_msg = grib_get_error_message(*err);
const size_t erlen = strlen(err_msg); const size_t erlen = strlen(err_msg);
if( len < erlen) return GRIB_ARRAY_TOO_SMALL; 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; return GRIB_SUCCESS;
} }
int grib_f_get_error_string__(int* err, char* buf, int len){ int grib_f_get_error_string__(int* err, char* buf, int len){
return grib_f_get_error_string_(err,buf,len); return grib_f_get_error_string_(err, buf, len);
} }
int grib_f_get_error_string(int* err, char* buf, int len){ int grib_f_get_error_string(int* err, char* buf, int len){
return grib_f_get_error_string_(err,buf,len); return grib_f_get_error_string_(err, buf, len);
} }
/*****************************************************************************/ /*****************************************************************************/