Commit 53535591 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Init compVar with zero (bug fix).

parent 8edf81f7
...@@ -680,6 +680,7 @@ compvar2_t gribapiVarSet(int param, int level1, int level2, int leveltype, int t ...@@ -680,6 +680,7 @@ compvar2_t gribapiVarSet(int param, int level1, int level2, int leveltype, int t
size_t gridsize, char *name, var_tile_t tiles_data) size_t gridsize, char *name, var_tile_t tiles_data)
{ {
compvar2_t compVar; compvar2_t compVar;
memset(&compVar, 0, sizeof(compvar2_t));
size_t maxlen = sizeof(compVar.name); size_t maxlen = sizeof(compVar.name);
size_t len = strlen(name); size_t len = strlen(name);
if ( len > maxlen ) len = maxlen; if ( len > maxlen ) len = maxlen;
...@@ -690,7 +691,7 @@ compvar2_t gribapiVarSet(int param, int level1, int level2, int leveltype, int t ...@@ -690,7 +691,7 @@ compvar2_t gribapiVarSet(int param, int level1, int level2, int leveltype, int t
compVar.ltype = leveltype; compVar.ltype = leveltype;
compVar.tsteptype = tsteptype; compVar.tsteptype = tsteptype;
compVar.gridsize = gridsize; compVar.gridsize = gridsize;
memset(compVar.name, 0, maxlen); //memset(compVar.name, 0, maxlen);
memcpy(compVar.name, name, len); memcpy(compVar.name, name, len);
compVar.tiles = tiles_data; compVar.tiles = tiles_data;
...@@ -701,6 +702,7 @@ static ...@@ -701,6 +702,7 @@ static
int gribapiVarCompare(compvar2_t compVar, record_t record, int flag) int gribapiVarCompare(compvar2_t compVar, record_t record, int flag)
{ {
compvar2_t compVar0; compvar2_t compVar0;
memset(&compVar0, 0, sizeof(compvar2_t));
compVar0.param = record.param; compVar0.param = record.param;
compVar0.level1 = record.ilevel; compVar0.level1 = record.ilevel;
compVar0.level2 = record.ilevel2; compVar0.level2 = record.ilevel2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment