Skip to content

Commit

Permalink
BACKENDS/GRAPHICS: Silence non zero-terminated terminated buffers war…
Browse files Browse the repository at this point in the history
…nings by initializing the buffers to 0
  • Loading branch information
Templier committed Jun 23, 2011
1 parent 367605d commit 8a5bda7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions backends/platform/sdl/sdl.cpp
Expand Up @@ -413,6 +413,7 @@ void OSystem_SDL::setupIcon() {
for (i = 0; i < ncols; i++) {
unsigned char code;
char color[32];
memset(color, 0, sizeof(color));
unsigned int col;
if (sscanf(scummvm_icon[1 + i], "%c c %s", &code, color) != 2) {
warning("Wrong format of scummvm_icon[%d] (%s)", 1 + i, scummvm_icon[1 + i]);
Expand Down
4 changes: 4 additions & 0 deletions graphics/font.cpp
Expand Up @@ -214,6 +214,8 @@ int bdf_read_header(Common::SeekableReadStream &fp, NewFontData* pf) {
char buf[256];
char facename[256];
char copyright[256];
memset(facename, 0, sizeof(facename));
memset(copyright, 0, sizeof(copyright));

/* set certain values to errors for later error checking*/
pf->defaultchar = -1;
Expand All @@ -235,6 +237,7 @@ int bdf_read_header(Common::SeekableReadStream &fp, NewFontData* pf) {
warning("Error: bad 'FONT'");
return 0;
}

pf->facename = strdup(facename);
continue;
}
Expand All @@ -243,6 +246,7 @@ int bdf_read_header(Common::SeekableReadStream &fp, NewFontData* pf) {
warning("Error: bad 'COPYRIGHT'");
return 0;
}

pf->copyright = strdup(copyright);
continue;
}
Expand Down

0 comments on commit 8a5bda7

Please sign in to comment.