[lammps-users] Segfault in read_data

Dear List,

Here is the patch to fix the segfault in the Atoms section. My analysis of the code suggests that output of strtok needs to be checked, as it can return NULL, depending upon input.

Please review this patch and apply upstream if acceptable. Perhaps a better error message could be used.

I recommend running cppcheck (cppcheck.sourceforge.net) over the source -- it is very useful and can catch these sorts of errors automatically.

Hopefully fixing this bug will help others over the initial difficulty I had.

For any future internet searchers, an example file for the atoms section in read_data is:

read_atoms.patch (515 Bytes)