summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-04 11:35:40 +0200
committer/dev/humancontroller <devhc@example.com>2017-04-06 20:36:00 +0200
commit6746eb87f6893045e5dd6951094d219df9f0ddac (patch)
treea0e09d96557197fa474fde5e60c42a6607a51973
parent7cdefa131c9c91b522e575a66ea6504d71141f85 (diff)
fix a pointer going out of bounds, in the text width calculation code
the cgame QVM was calling strncpy() with a size argument of -1
-rw-r--r--src/ui/ui_shared.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 5daf33b7..02a45bf5 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -4351,7 +4351,8 @@ const char *Item_Text_Wrap( const char *text, float scale, float width )
if( !previousCharIsSpace && isspace( *q ) )
eol = q;
- textWidth += UI_Char_Width( &q, scale );
+ if( q != eos )
+ textWidth += UI_Char_Width( &q, scale );
}
// No split has taken place, so just split mid-word