diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index d0133f075c..c297bad2ef 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -3687,7 +3687,7 @@ CONTAINS n = LEN_TRIM(f_string) ptr = lammps_malloc(n+1) - CALL C_F_POINTER(ptr, c_string, [1]) + CALL C_F_POINTER(ptr, c_string, [n+1]) DO i=1, n c_string(i) = f_string(i:i) END DO