aboutsummaryrefslogtreecommitdiff
path: root/engines/gnap/gamesys.cpp
diff options
context:
space:
mode:
authorStrangerke2016-05-24 07:30:30 +0200
committerStrangerke2016-05-24 07:46:21 +0200
commitd70e3dd0d6f55685dd236c5205b1accad4352068 (patch)
treec9a7c5877c43601170850d66438ec1f3e63987cd /engines/gnap/gamesys.cpp
parenta923745973bfe7d0f1fba8184add7ec9c320c5e5 (diff)
downloadscummvm-rg350-d70e3dd0d6f55685dd236c5205b1accad4352068.tar.gz
scummvm-rg350-d70e3dd0d6f55685dd236c5205b1accad4352068.tar.bz2
scummvm-rg350-d70e3dd0d6f55685dd236c5205b1accad4352068.zip
GNAP: Fix out of bound access in alternate font code
Diffstat (limited to 'engines/gnap/gamesys.cpp')
-rw-r--r--engines/gnap/gamesys.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp
index 8fcf1dca58..80cf68943f 100644
--- a/engines/gnap/gamesys.cpp
+++ b/engines/gnap/gamesys.cpp
@@ -287,7 +287,7 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r
} else {
for (const char *cp = text; *cp != 0; ++cp) {
byte c = *cp;
- if (c < 32 || c > 127)
+ if (c < 32 || c >= 127)
c = (byte)'_';
c -= 32;
int w = _dejaVuSans9ptCharDescriptors[c]._width;
@@ -312,7 +312,7 @@ int GameSys::getTextHeight(const char *text) {
byte height = 0;
for (const char *cp = text; *cp != 0; ++cp) {
byte c = *cp;
- if (c < 32 || c > 127)
+ if (c < 32 || c >= 127)
c = (byte)'_';
c -= 32;
height = MAX(height, _dejaVuSans9ptCharDescriptors[c]._width);
@@ -324,7 +324,7 @@ int GameSys::getTextWidth(const char *text) {
int width = 0;
for (const char *cp = text; *cp != 0; ++cp) {
byte c = *cp;
- if (c < 32 || c > 127)
+ if (c < 32 || c >= 127)
c = (byte)'_';
c -= 32;
width += _dejaVuSans9ptCharDescriptors[c]._width + 1;