BACKENDS/GRAPHICS: Silence non zero-terminated terminated buffers warnings by initializing the buffers to 0

This commit is contained in:
Julien 2011-06-05 05:50:40 +08:00 committed by Julien
parent 367605d774
commit 8a5bda72cc
2 changed files with 5 additions and 0 deletions

View File

@ -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]);

View File

@ -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;
@ -235,6 +237,7 @@ int bdf_read_header(Common::SeekableReadStream &fp, NewFontData* pf) {
warning("Error: bad 'FONT'");
return 0;
}
pf->facename = strdup(facename);
continue;
}
@ -243,6 +246,7 @@ int bdf_read_header(Common::SeekableReadStream &fp, NewFontData* pf) {
warning("Error: bad 'COPYRIGHT'");
return 0;
}
pf->copyright = strdup(copyright);
continue;
}