[AMBER] [PATCH 1/8] AmberTools: Fix buffer overflows in mdgx, nab and ptraj

From: Reinis Danne <gam4rei.gmail.com>
Date: Tue, 23 Oct 2012 01:14:54 +0300

From: Reinis Danne <rei4dan.gmail.com>

diff --git a/AmberTools/src/mdgx/Trajectory.c b/AmberTools/src/mdgx/Trajectory.c
index 524dad8..5df64c6 100644
--- a/AmberTools/src/mdgx/Trajectory.c
+++ b/AmberTools/src/mdgx/Trajectory.c
.. -214,7 +214,7 .. void ExtendCoordinates(coord *tc, prmtop *tp)
 coord ReadRst(prmtop *tp, char* source)
 {
   int i, rsttype;
- char line[128];
+ char line[MAXLINE];
   FILE *inp;
   coord tc;
 
diff --git a/AmberTools/src/nab/database.c b/AmberTools/src/nab/database.c
index 0b98d35..9aad62a 100644
--- a/AmberTools/src/nab/database.c
+++ b/AmberTools/src/nab/database.c
.. -1135,7 +1135,7 .. int* iPLines;
 char* PBuffer;
 int iBufferInc;
 {
-String sLine;
+String sLine[MAXDATALINELEN];
 
 
 
diff --git a/AmberTools/src/ptraj/trajectory.c b/AmberTools/src/ptraj/trajectory.c
index 110ffce..49bdf1a 100644
--- a/AmberTools/src/ptraj/trajectory.c
+++ b/AmberTools/src/ptraj/trajectory.c
.. -1315,7 +1315,7 .. readAmberTrajectory_nobuffer(FILE *fpin, int natoms,
 {
   fpos_t fileMarker; /* marker for current file postition */
   char *junk;
- char buffer[120];
+ char buffer[BUFFER_SIZE];
   char coords[26]; /* room for 24 characters (3f8.3) + \n + (char) 0 */
   char c;
   int j,ret;
-- 
1.7.12.4
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Oct 22 2012 - 15:30:05 PDT
Custom Search