diff --git a/src/h5core/h5t_errorhandling.c b/src/h5core/h5t_errorhandling.c index 1286eb2..a2a1cc9 100644 --- a/src/h5core/h5t_errorhandling.c +++ b/src/h5core/h5t_errorhandling.c @@ -15,16 +15,19 @@ h5tpriv_error_local_elem_nexist ( h5_file_t * const f, h5_id_t local_vids[] ) { + h5t_fdata_t* t = f->t; char s[1024]; int num_chars_printed = snprintf (s, sizeof(s), "%lld,", local_vids[0]); int i; - for (i = 1; i < f->t->mesh_type; i++) { + int num_vertices = t->ref_element->num_faces[0]; + for (i = 1; i < num_vertices; i++) { num_chars_printed += snprintf ( s+num_chars_printed, sizeof(s)-num_chars_printed, "%lld,", local_vids[i]); if ((sizeof(s) - num_chars_printed) < 32) { - h5_error_internal ( f, __FILE__, __func__, __LINE__ ); + // buffer to small + return h5_error_internal (f, __FILE__, __func__, __LINE__); } }