From 77da6900a818eaee3575a00e5f6a20951d1c3da8 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Fri, 12 May 2017 18:54:01 -0400 Subject: [PATCH] Prevents GFXDrawUtil::drawTextN() from drawing one character more than requested if in_string has more than n characters. --- Engine/source/gfx/gfxDrawUtil.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Engine/source/gfx/gfxDrawUtil.cpp b/Engine/source/gfx/gfxDrawUtil.cpp index 3dfe28a3e..958ca0a51 100644 --- a/Engine/source/gfx/gfxDrawUtil.cpp +++ b/Engine/source/gfx/gfxDrawUtil.cpp @@ -148,9 +148,8 @@ U32 GFXDrawUtil::drawTextN( GFont *font, const Point2I &ptDraw, const UTF8 *in_s return ptDraw.x; // Convert to UTF16 temporarily. - n++; // space for null terminator - FrameTemp ubuf( n ); - convertUTF8toUTF16N(in_string, ubuf, n); + FrameTemp ubuf( n + 1 ); // (n+1) to add space for null terminator + convertUTF8toUTF16N(in_string, ubuf, n + 1); return drawTextN( font, ptDraw, ubuf, n, colorTable, maxColorIndex, rot ); }