aboutsummaryrefslogtreecommitdiff
path: root/graphics/fonts
diff options
context:
space:
mode:
authorColin Snover2017-12-04 20:28:37 -0600
committerEugene Sandulenko2018-08-18 16:30:05 +0200
commitf7e05a6acefc20be045fbc703b358c6c6ba67503 (patch)
tree8a69d82e8d42e29314c5f40a0466ceeaac32fd90 /graphics/fonts
parentc544d8050cb59e3f07062d2de12dc0faff04d436 (diff)
downloadscummvm-rg350-f7e05a6acefc20be045fbc703b358c6c6ba67503.tar.gz
scummvm-rg350-f7e05a6acefc20be045fbc703b358c6c6ba67503.tar.bz2
scummvm-rg350-f7e05a6acefc20be045fbc703b358c6c6ba67503.zip
GRAPHICS: Fix incorrect maximum length passed to strlcpy
Diffstat (limited to 'graphics/fonts')
-rw-r--r--graphics/fonts/bdf.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index 03c1b7b541..96255dc4d4 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -411,8 +411,8 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
boxes[encoding] = box;
}
} else if (line.hasPrefix("FAMILY_NAME \"")) {
- familyName = new char[line.size()]; // We will definitely fit here
- Common::strlcpy(familyName, &line.c_str()[13], line.size());
+ familyName = new char[line.size()];
+ Common::strlcpy(familyName, line.c_str() + 13, line.size() - 13);
char *p = &familyName[strlen(familyName)];
while (p != familyName && *p != '"')
p--;
@@ -428,8 +428,8 @@ BdfFont *BdfFont::loadFont(Common::SeekableReadStream &stream) {
}
*p = '\0'; // Remove last quote
} else if (line.hasPrefix("SLANT \"")) {
- slant = new char[line.size()]; // We will definitely fit here
- Common::strlcpy(slant, &line.c_str()[7], line.size());
+ slant = new char[line.size()];
+ Common::strlcpy(slant, line.c_str() + 7, line.size() - 7);
char *p = &slant[strlen(slant)];
while (p != slant && *p != '"')
p--;