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

gridPrintAttributes: terminate txt attribute.

parent 4a02cdd4
......@@ -3474,9 +3474,10 @@ void gridPrintAttributes(FILE *fp, int gridID)
if ( atttype == DATATYPE_TXT )
{
size_t attSize = (size_t)attlen*sizeof(char);
size_t attSize = (size_t)(attlen+1)*sizeof(char);
char *atttxt = (char *)resizeBuffer(&attBuf, &attBufSize, attSize);
vlistInqAttTxt(cdiID, varID, attname, attlen, atttxt);
atttxt[attlen] = 0;
fprintf(fp, "ATTR_TXT_%d:%s = \"%s\"\n", attlen, attname, atttxt);
}
else if ( atttype == DATATYPE_INT8 || atttype == DATATYPE_UINT8 ||
......
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