CID 1249930: Don't scanf uninitialized buffer
Would happen in case of a missing config file, for instance.
This commit is contained in:
@@ -130,10 +130,8 @@ MidiSettingsView::_LoadSettings()
|
|||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||||
path.Append(SETTINGS_FILE);
|
path.Append(SETTINGS_FILE);
|
||||||
BFile file(path.Path(), B_READ_ONLY);
|
BFile file(path.Path(), B_READ_ONLY);
|
||||||
if (file.InitCheck() == B_OK)
|
if (file.InitCheck() == B_OK) {
|
||||||
file.Read(buffer, sizeof(buffer));
|
file.Read(buffer, sizeof(buffer));
|
||||||
}
|
|
||||||
|
|
||||||
char soundFont[512];
|
char soundFont[512];
|
||||||
sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
|
sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
|
||||||
soundFont);
|
soundFont);
|
||||||
@@ -146,6 +144,8 @@ MidiSettingsView::_LoadSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user