PCMSolver / pcmsolver

An API for the Polarizable Continuum Model
http://pcmsolver.readthedocs.io/
GNU Lesser General Public License v3.0
32 stars 21 forks source link

Buffer overload when requesting Allinger radii through the C interface #194

Closed nielskm closed 3 years ago

nielskm commented 3 years ago

When trying to use the Allinger atomic radii through the PCMInput struct, you overflow the buffer of size 8, since a null-termination character is also needed. I.e. the line: std::strcpy(input.radii_set, "allinger"); results in a buffer overflow.

NB: This only occurs when compiling in Release mode.

Possible Solution

Change the size of PCMInput::radii_set to 9.

Steps to Reproduce (for bugs)

  1. Make a C interface like the one in test/C_host and change the radii set to "allinger".
  2. Compile PCMSolver in release mode (-DCMAKE_BUILD_TYPE=Release).
  3. Run the test.

Your Environment