From 41ee1efa1374b693239e7c1870b3e39f5760fbfd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 18 Mar 2024 10:27:38 -0400 Subject: [PATCH] fix bug in f2c string conversion detected by bound checking --- fortran/lammps.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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