$OpenBSD: patch-src_SciTEProps_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/SciTEProps.cxx.orig	Mon Jan 15 12:02:13 2007
+++ src/SciTEProps.cxx	Mon Jan 15 12:02:56 2007
@@ -175,7 +175,7 @@ bool PropSetFile::Read(FilePath filename
 
 void PropSetFile::SetInteger(const char *key, sptr_t i) {
 	char tmp[32];
-	sprintf(tmp, "%d", static_cast<int>(i));
+	snprintf(tmp, sizeof(tmp), "%d", static_cast<int>(i));
 	Set(key, tmp);
 }
 
@@ -342,8 +342,7 @@ const char *SciTEBase::GetNextPropItem(
 		}
 		pNext++;
 	}
-	strncpy(pPropItem, pStart, size);
-	pPropItem[size] = '\0';
+	strlcpy(pPropItem, pStart, size);
 	return pNext;
 }
 
@@ -499,7 +498,7 @@ void SciTEBase::SetStyleFor(Window &win,
 	for (int style = 0; style <= STYLE_MAX; style++) {
 		if (style != STYLE_DEFAULT) {
 			char key[200];
-			sprintf(key, "style.%s.%0d", lang, style);
+			snprintf(key, sizeof(key), "style.%s.%0d", lang, style);
 			SString sval = props.GetExpanded(key);
 			SetOneStyle(win, style, sval.c_str());
 		}
@@ -523,7 +522,7 @@ SString SciTEBase::ExtensionFileName() {
 		if (name.IsSet()) {
 			// Force extension to lower case
 			char fileNameWithLowerCaseExtension[MAX_PATH];
-				strcpy(fileNameWithLowerCaseExtension, name.AsInternal());
+				strlcpy(fileNameWithLowerCaseExtension, name.AsInternal(), sizeof(fileNameWithLowerCaseExtension));
 			char *extension = strrchr(fileNameWithLowerCaseExtension, '.');
 			if (extension) {
 				LowerCaseString(extension);
@@ -927,7 +926,7 @@ void SciTEBase::ReadProperties() {
 	}
 
 	char bracesStyleKey[200];
-	sprintf(bracesStyleKey, "braces.%s.style", language.c_str());
+	snprintf(bracesStyleKey, sizeof(bracesStyleKey), "braces.%s.style", language.c_str());
 	bracesStyle = props.GetInt(bracesStyleKey, 0);
 
 	char key[200];
@@ -945,13 +944,13 @@ void SciTEBase::ReadProperties() {
 
 	calltipEndDefinition = FindLanguageProperty("calltip.*.end.definition");
 
-	sprintf(key, "autocomplete.%s.start.characters", language.c_str());
+	snprintf(key, sizeof(key), "autocomplete.%s.start.characters", language.c_str());
 	autoCompleteStartCharacters = props.GetExpanded(key);
 	if (autoCompleteStartCharacters == "")
 		autoCompleteStartCharacters = props.GetExpanded("autocomplete.*.start.characters");
 	// "" is a quite reasonable value for this setting
 
-	sprintf(key, "autocomplete.%s.fillups", language.c_str());
+	snprintf(key, sizeof(key), "autocomplete.%s.fillups", language.c_str());
 	autoCompleteFillUpCharacters = props.GetExpanded(key);
 	if (autoCompleteFillUpCharacters == "")
 		autoCompleteFillUpCharacters =
@@ -959,10 +958,10 @@ void SciTEBase::ReadProperties() {
 	SendEditorString(SCI_AUTOCSETFILLUPS, 0,
 		autoCompleteFillUpCharacters.c_str());
 
-	sprintf(key, "autocomplete.%s.ignorecase", "*");
+	snprintf(key, sizeof(key), "autocomplete.%s.ignorecase", "*");
 	sval = props.GetNewExpand(key);
 	autoCompleteIgnoreCase = sval == "1";
-	sprintf(key, "autocomplete.%s.ignorecase", language.c_str());
+	snprintf(key, sizeof(key), "autocomplete.%s.ignorecase", language.c_str());
 	sval = props.GetNewExpand(key);
 	if (sval != "")
 		autoCompleteIgnoreCase = sval == "1";
@@ -1236,12 +1235,12 @@ void SciTEBase::ReadFontProperties() {
 	SendEditor(SCI_STYLERESETDEFAULT, 0, 0);
 	SendOutput(SCI_STYLERESETDEFAULT, 0, 0);
 
-	sprintf(key, "style.%s.%0d", "*", STYLE_DEFAULT);
+	snprintf(key, sizeof(key), "style.%s.%0d", "*", STYLE_DEFAULT);
 	sval = props.GetNewExpand(key);
 	SetOneStyle(wEditor, STYLE_DEFAULT, sval.c_str());
 	SetOneStyle(wOutput, STYLE_DEFAULT, sval.c_str());
 
-	sprintf(key, "style.%s.%0d", language.c_str(), STYLE_DEFAULT);
+	snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), STYLE_DEFAULT);
 	sval = props.GetNewExpand(key);
 	SetOneStyle(wEditor, STYLE_DEFAULT, sval.c_str());
 
@@ -1252,7 +1251,7 @@ void SciTEBase::ReadFontProperties() {
 
 	SendOutput(SCI_STYLECLEARALL, 0, 0);
 
-	sprintf(key, "style.%s.%0d", "errorlist", STYLE_DEFAULT);
+	snprintf(key, sizeof(key), "style.%s.%0d", "errorlist", STYLE_DEFAULT);
 	sval = props.GetNewExpand(key);
 	SetOneStyle(wOutput, STYLE_DEFAULT, sval.c_str());
 
