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

NetCDF zero length number attributes cause null-pointer dereference [Bug: #8589].

parent 23bafc45
......@@ -96,8 +96,8 @@ bool cdiInqAttConvertedToFloat(int gridID, int atttype, const char *attname, int
{
int attint;
int *pattint = attlen > 1 ? (int*) malloc(attlen*sizeof(int)) : &attint;
cdiInqAttInt(gridID, CDI_GLOBAL, attname, attlen, attint);
for ( int i = 0; i < attlen; ++i ) attflt[i] = (double)attint[i];
cdiInqAttInt(gridID, CDI_GLOBAL, attname, attlen, pattint);
for ( int i = 0; i < attlen; ++i ) attflt[i] = (double)pattint[i];
if (attlen > 1) free(pattint);
}
else if ( atttype == CDI_DATATYPE_FLT32 || atttype == CDI_DATATYPE_FLT64 )
......
Supports Markdown
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