mirror of https://github.com/ecmwf/eccodes.git
Checks for descriptor string lengths
This commit is contained in:
parent
5b0f7ba936
commit
89af2ae8dd
|
@ -343,8 +343,6 @@ static int bufr_get_from_table(grib_accessor* a, bufr_descriptor* v)
|
|||
int ret = 0;
|
||||
char** list = 0;
|
||||
char code[7] = { 0 };
|
||||
const size_t maxlen_shortName = sizeof(v->shortName);
|
||||
const size_t maxlen_units = sizeof(v->units);
|
||||
|
||||
grib_trie* table = load_bufr_elements_table(a, &ret);
|
||||
if (ret)
|
||||
|
@ -356,11 +354,19 @@ static int bufr_get_from_table(grib_accessor* a, bufr_descriptor* v)
|
|||
if (!list)
|
||||
return GRIB_NOT_FOUND;
|
||||
|
||||
DebugAssert( strlen(list[1]) < maxlen_shortName );
|
||||
#ifdef DEBUG
|
||||
{
|
||||
/* ECC-1137: check descriptor key name and unit lengths */
|
||||
const size_t maxlen_shortName = sizeof(v->shortName);
|
||||
const size_t maxlen_units = sizeof(v->units);
|
||||
Assert( strlen(list[1]) < maxlen_shortName );
|
||||
Assert( strlen(list[4]) < maxlen_units );
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy(v->shortName, list[1]);
|
||||
v->type = convert_type(list[2]);
|
||||
/* v->name=grib_context_strdup(c,list[3]); See ECC-489 */
|
||||
DebugAssert( strlen(list[4]) < maxlen_units );
|
||||
strcpy(v->units, list[4]);
|
||||
|
||||
/* ECC-985: Scale and reference are often 0 so we can reduce calls to atol */
|
||||
|
|
Loading…
Reference in New Issue