AMBER Archive (2006)

Subject: top2mol2.c scanf format string bug

From: Chris Moth (chris.moth_at_vanderbilt.edu)
Date: Mon Nov 06 2006 - 18:19:36 CST


In $AMBERHOME/src/antechamber/top2mol2.c there is this:

21: long crd_atomnum = 0;
....
194: sscanf(line, "%d", &crd_atomnum);

On one of our platforms, sizeof(long) == 8 and sizeof(int) == 4, and
line 194 is a bug.

Changing line 194 to %ld instead of %d as in:

194: sscanf(line, "%ld", &crd_atomnum);

allowed some antechamber tests to pass, tests which otherwise failed due
to residual binary junk in crd_atomnum.

Chris