[sword-svn] r3511 - trunk/src/modules/filters

scribe at crosswire.org scribe at crosswire.org
Wed Nov 1 04:18:50 MST 2017


Author: scribe
Date: 2017-11-01 04:18:50 -0700 (Wed, 01 Nov 2017)
New Revision: 3511

Modified:
   trunk/src/modules/filters/gbfstrongs.cpp
   trunk/src/modules/filters/gbfwordjs.cpp
   trunk/src/modules/filters/greeklexattribs.cpp
   trunk/src/modules/filters/osisstrongs.cpp
   trunk/src/modules/filters/osiswordjs.cpp
   trunk/src/modules/filters/thmlstrongs.cpp
   trunk/src/modules/filters/thmlwordjs.cpp
Log:
Protected against sprintf overflow (patch submitted by Jaak Ristioja)

Modified: trunk/src/modules/filters/gbfstrongs.cpp
===================================================================
--- trunk/src/modules/filters/gbfstrongs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/gbfstrongs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -58,7 +58,7 @@
 	bool lastspace = false;
 	int word = 1;
 	char val[128];
-	char wordstr[5];
+	char wordstr[11];
 	char *valto;
 	unsigned int textStart = 0, textEnd = 0;
 	bool newText = false;

Modified: trunk/src/modules/filters/gbfwordjs.cpp
===================================================================
--- trunk/src/modules/filters/gbfwordjs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/gbfwordjs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -137,7 +137,7 @@
 				text += token;
 				text += '>';
 				if (needWordOut) {
-					char wstr[10];
+					char wstr[11];
 					sprintf(wstr, "%03d", word-2);
 					AttributeValue *wAttrs = &(module->getEntryAttributes()["Word"][wstr]);
 					needWordOut = false;
@@ -234,7 +234,7 @@
 			}
 		}
 
-		char wstr[10];
+		char wstr[11];
 		sprintf(wstr, "%03d", word-1);
 		AttributeValue *wAttrs = &(module->getEntryAttributes()["Word"][wstr]);
 		needWordOut = false;

Modified: trunk/src/modules/filters/greeklexattribs.cpp
===================================================================
--- trunk/src/modules/filters/greeklexattribs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/greeklexattribs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -44,7 +44,7 @@
 		string phrase;
 		string freq;
 		char val[128], *valto;
-		char wordstr[7];
+		char wordstr[11];
 		const char *currentPhrase = 0;
 		const char *currentPhraseEnd = 0;
 		int number = 0;

Modified: trunk/src/modules/filters/osisstrongs.cpp
===================================================================
--- trunk/src/modules/filters/osisstrongs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/osisstrongs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -57,7 +57,7 @@
 	SWBuf token;
 	bool intoken = false;
 	int wordNum = 1;
-	char wordstr[5];
+	char wordstr[11];
 	const char *wordStart = 0;
 	SWBuf page = "";		// some modules include <seg> page info, so we add these to the words
 

Modified: trunk/src/modules/filters/osiswordjs.cpp
===================================================================
--- trunk/src/modules/filters/osiswordjs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/osiswordjs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -66,7 +66,7 @@
 		int tokpos = 0;
 		bool intoken = false;
 		int wordNum = 1;
-		char wordstr[5];
+		char wordstr[11];
 		SWBuf modName = (module)?module->getName():"";
 		// add TR to w src in KJV then remove this next line
 		SWBuf wordSrcPrefix = (modName == "KJV")?SWBuf("TR"):modName;

Modified: trunk/src/modules/filters/thmlstrongs.cpp
===================================================================
--- trunk/src/modules/filters/thmlstrongs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/thmlstrongs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -60,7 +60,7 @@
 	bool lastspace = false;
 	int word = 1;
 	char val[128];
-	char wordstr[5];
+	char wordstr[11];
 	char *valto;
 	char *ch;
 	unsigned int textStart = 0, textEnd = 0;

Modified: trunk/src/modules/filters/thmlwordjs.cpp
===================================================================
--- trunk/src/modules/filters/thmlwordjs.cpp	2017-11-01 10:37:23 UTC (rev 3510)
+++ trunk/src/modules/filters/thmlwordjs.cpp	2017-11-01 11:18:50 UTC (rev 3511)
@@ -68,7 +68,7 @@
 		char val[128];
 		char *valto;
 		char *ch;
-		char wordstr[5];
+		char wordstr[11];
 		unsigned int textStart = 0, lastAppendLen = 0, textEnd = 0;
 		SWBuf tmp;
 		bool newText = false;
@@ -151,7 +151,7 @@
 				text += token;
 				text += '>';
 				if (needWordOut) {
-					char wstr[10];
+					char wstr[11];
 					sprintf(wstr, "%03d", word-2);
 					AttributeValue *wAttrs = &(module->getEntryAttributes()["Word"][wstr]);
 					needWordOut = false;
@@ -248,7 +248,7 @@
 			}
 		}
 
-		char wstr[10];
+		char wstr[11];
 		sprintf(wstr, "%03d", word-1);
 		AttributeValue *wAttrs = &(module->getEntryAttributes()["Word"][wstr]);
 		needWordOut = false;




More information about the sword-cvs mailing list