Commit 2793dd54 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

vlistDefAttXXX: limit length of attribute name to CDI_MAX_NAME

parent 502ce990
2014-12-14 Uwe Schulzweida
2014-12-11 Uwe Schulzweida
* Version 1.6.7 released
2014-12-10 Uwe Schulzweida
* vlistDefAttXXX: limit length of attribute name to CDI_MAX_NAME
2014-12-05 Uwe Schulzweida
* netCDF absolute time axis with units month: change day from 00 to 01
......
......@@ -67,7 +67,6 @@ char *strdup(const char *s);
#include "cdi.h"
#define check_parg(arg) if ( arg == 0 ) Warning("Argument '" #arg "' not allocated!")
#if defined (__xlC__) /* performance problems on IBM */
......
......@@ -41,13 +41,13 @@ cdi_att_t *find_att(cdi_atts_t *attsp, const char *name)
if ( attsp->nelems == 0 ) return NULL;
size_t slen = strlen(name);
if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
cdi_att_t *atts = attsp->value;
for (size_t attid = 0; attid < attsp->nelems; attid++)
for ( size_t attid = 0; attid < attsp->nelems; attid++ )
{
cdi_att_t *attp = atts + attid;
if (attp->namesz == slen
&& memcmp(attp->name, name, slen) == 0)
if ( attp->namesz == slen && memcmp(attp->name, name, slen) == 0 )
return (attp); /* Normal return */
}
......@@ -69,6 +69,7 @@ cdi_att_t *new_att(cdi_atts_t *attsp, const char *name)
attsp->nelems++;
slen = strlen(name);
if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
attp->name = (char *) malloc(slen+1);
memcpy(attp->name, name, slen+1);
......
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