diff --git a/tools/grib_to_netcdf.c b/tools/grib_to_netcdf.c index ec685d62a..afdda6681 100644 --- a/tools/grib_to_netcdf.c +++ b/tools/grib_to_netcdf.c @@ -27,7 +27,7 @@ const char* grib_tool_description = "Convert a GRIB file to netCDF format."; const char* grib_tool_name = "grib_to_netcdf"; const char* grib_tool_usage = "[options] grib_file grib_file ... "; -static char argvString[2048]; +static char argvString[2048] = {0,}; /*=====================================================================*/ @@ -3978,7 +3978,11 @@ int main(int argc, char *argv[]) int i, ret = 0; /* GRIB-413: Collect all program arguments into a string */ + const size_t maxLen = sizeof(argvString); + size_t currLen = 0; for (i=0; i= maxLen-1 ) break; strcat(argvString, argv[i]); if (i != argc-1) strcat(argvString, " "); }