diff --git a/examples/main.c b/examples/main.c index 116d422c9adae14d4b14ec4467378c65a53aa0da..fb48f4112386031a86936c6f77398a49f9581ca3 100644 --- a/examples/main.c +++ b/examples/main.c @@ -1057,8 +1057,8 @@ int main(int argc, char *argv[]) { #ifdef WITH_MPI /* Make sure output file is empty, only on one rank. */ - char dumpfile[30]; - snprintf(dumpfile, 30, "thread_info_MPI-step%d.dat", j + 1); + char dumpfile[35]; + snprintf(dumpfile, sizeof(dumpfile), "thread_info_MPI-step%d.dat", j + 1); FILE *file_thread; if (myrank == 0) { file_thread = fopen(dumpfile, "w"); @@ -1114,8 +1114,8 @@ int main(int argc, char *argv[]) { } #else - char dumpfile[30]; - snprintf(dumpfile, 30, "thread_info-step%d.dat", j + 1); + char dumpfile[32]; + snprintf(dumpfile, sizeof(dumpfile), "thread_info-step%d.dat", j + 1); FILE *file_thread; file_thread = fopen(dumpfile, "w"); /* Add some information to help with the plots */