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

vlistInqAtt: return -1 if attnum is out of range

parent 36560a71
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* Version 1.7.0 released * Version 1.7.0 released
* using CGRIBEX library version 1.7.0 * using CGRIBEX library version 1.7.0
2014-07-25 Uwe Schulzweida
* vlistInqAtt: return -1 if attnum is out of range
2014-07-24 Uwe Schulzweida 2014-07-24 Uwe Schulzweida
* gribapiEncode: update additional keys defined with vlistDefVarXXXKey() [Feature #4720] * gribapiEncode: update additional keys defined with vlistDefVarXXXKey() [Feature #4720]
......
...@@ -153,15 +153,13 @@ The function @func{vlistInqAtt} gets information about an attribute. ...@@ -153,15 +153,13 @@ The function @func{vlistInqAtt} gets information about an attribute.
int vlistInqAtt(int vlistID, int varID, int attnum, char *name, int *typep, int *lenp) int vlistInqAtt(int vlistID, int varID, int attnum, char *name, int *typep, int *lenp)
{ {
int status = CDI_NOERR; int status = CDI_NOERR;
vlist_t *vlistptr;
cdi_att_t *attp = NULL; cdi_att_t *attp = NULL;
cdi_atts_t *attsp;
xassert(name != NULL); xassert(name != NULL);
vlistptr = vlist_to_pointer(vlistID); vlist_t *vlistptr = vlist_to_pointer(vlistID);
attsp = get_attsp(vlistptr, varID); cdi_atts_t *attsp = get_attsp(vlistptr, varID);
xassert(attsp != NULL); xassert(attsp != NULL);
if ( attnum >= 0 && attnum < (int)attsp->nelems ) if ( attnum >= 0 && attnum < (int)attsp->nelems )
...@@ -178,6 +176,7 @@ int vlistInqAtt(int vlistID, int varID, int attnum, char *name, int *typep, int ...@@ -178,6 +176,7 @@ int vlistInqAtt(int vlistID, int varID, int attnum, char *name, int *typep, int
name[0] = 0; name[0] = 0;
*typep = -1; *typep = -1;
*lenp = 0; *lenp = 0;
status = -1;
} }
return (status); return (status);
......
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