File rekall-xbsql-overflows.diff of Package rekall
--- support/xbsql/xb_fieldset.cpp
+++ support/xbsql/xb_fieldset.cpp
@@ -72,8 +72,8 @@ XBSQL::Index
char buff[255] ;
strncpy (buff, tabname, sizeof(buff)) ;
- strncat (buff, "_", sizeof(buff)) ;
- strncat (buff, getFieldName(fldno), sizeof(buff)) ;
+ strncat (buff, "_", sizeof(buff)-strlen(buff)-1) ;
+ strncat (buff, getFieldName(fldno), sizeof(buff)-strlen(buff)-1) ;
const char *path = xbase->getPath (buff, "ndx") ;
int fd = open (path, O_RDONLY) ;
--- support/xbsql/xbsql.cpp
+++ support/xbsql/xbsql.cpp
@@ -379,8 +379,8 @@ bool XBaseSQL::createTable
xbNdx ndxFile (&dbfFile) ;
strncpy (name, table, sizeof(name)) ;
- strncat (name, "_", sizeof(name)) ;
- strncat (name, schema[idx].FieldName, sizeof(name)) ;
+ strncat (name, "_", sizeof(name)-strlen(name)-1) ;
+ strncat (name, schema[idx].FieldName, sizeof(name)-strlen(name)-1) ;
path = getPath (name, "ndx") ;
idxflag = index[idx] == XBSQL::IndexUnique ?
@@ -482,8 +482,8 @@ XBSQLTable *XBaseSQL::openTable
char name[256] ;
strncpy (name, table, sizeof(name)) ;
- strncat (name, "_", sizeof(name)) ;
- strncat (name, fSet.getFieldName (idx), sizeof(name)) ;
+ strncat (name, "_", sizeof(name)-strlen(name)-1) ;
+ strncat (name, fSet.getFieldName (idx), sizeof(name)-strlen(name)-1) ;
path = getPath (name, "ndx") ;
if (access(path, R_OK) == 0)
@@ -880,11 +880,11 @@ bool XBaseSQL::renameTable
const char *fname = fSet.getFieldName (idx) ;
strncpy (_oldName, oldName, sizeof(_oldName)) ;
- strncat (_oldName, "_", sizeof(_oldName)) ;
- strncat (_oldName, fname, sizeof(_oldName)) ;
+ strncat (_oldName, "_", sizeof(_oldName)-strlen(_oldName)-1) ;
+ strncat (_oldName, fname, sizeof(_oldName)-strlen(_oldName)-1) ;
strncpy (_newName, newName, sizeof(_newName)) ;
- strncat (_newName, "_", sizeof(_newName)) ;
- strncat (_newName, fname, sizeof(_newName)) ;
+ strncat (_newName, "_", sizeof(_newName)-strlen(_newName)-1) ;
+ strncat (_newName, fname, sizeof(_newName)-strlen(_newName)-1) ;
oldAnon = getPath (_oldName, "ndx") ;
newAnon = getPath (_newName, "ndx") ;
@@ -959,8 +959,8 @@ bool XBaseSQL::dropTable
const char *fname = fSet.getFieldName (idx) ;
strncpy (_idxName, table, sizeof(_idxName)) ;
- strncat (_idxName, "_", sizeof(_idxName)) ;
- strncat (_idxName, fname, sizeof(_idxName)) ;
+ strncat (_idxName, "_", sizeof(_idxName)-strlen(_idxName)-1) ;
+ strncat (_idxName, fname, sizeof(_idxName)-strlen(_idxName)-1) ;
tabAnon = getPath (_idxName, "ndx") ;