Permalink
Browse files

GRAPHICS: Fix incorrect maximum length passed to strlcpy

  • Loading branch information...
csnover authored and ccawley2011 committed Dec 5, 2017
1 parent 2fe87c6 commit c5680ca09671e96e27a9515b623d8f3d712a6d79
Showing with 4 additions and 4 deletions.
  1. +4 −4 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--;

0 comments on commit c5680ca

Please sign in to comment.