diff --git a/src/auto4_base.cpp b/src/auto4_base.cpp
index 8bb753d62e3ac000124a79903d3efb4f2c7bb1e0..d51a3e98fed901c4c908c3a627ead834dd54ec54 100644
--- a/src/auto4_base.cpp
+++ b/src/auto4_base.cpp
@@ -86,7 +86,7 @@ namespace Automation4 {
 		lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
 		lf.lfQuality = ANTIALIASED_QUALITY;
 		lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
-		wcsncpy(lf.lfFaceName, agi::charset::ConvertW(style->font).c_str(), 32);
+		wcsncpy(lf.lfFaceName, agi::charset::ConvertW(style->font).c_str(), 31);
 
 		HFONT thefont = CreateFontIndirect(&lf);
 		if (!thefont) return false;