You should understand that the problem here is not a buffer overflow made in Fortran part, as Fortran does know the length of z1 and will not copy more characters from the RHS. The problem is that Fortran will not put ‘\0’ character to mark the end of the string, as (almost all) C functions expect. And that’s one of the reasons other people here have been encouraging you (unsuccessfully
) to use proper Fortran-C interoperability mechanisms. Now with your conclusion
it proves to be even worse waste of their time.