CID 1249930: Don't scanf uninitialized buffer
Would happen in case of a missing config file, for instance.
This commit is contained in:
@@ -130,19 +130,19 @@ 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];
|
||||||
|
sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
|
||||||
|
soundFont);
|
||||||
|
|
||||||
char soundFont[512];
|
for (int32 i = 0; i < fListView->CountItems(); i++) {
|
||||||
sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
|
BStringItem* item = (BStringItem*)fListView->ItemAt(i);
|
||||||
soundFont);
|
if (!strcmp(item->Text(), soundFont)) {
|
||||||
|
fListView->Select(i);
|
||||||
for (int32 i = 0; i < fListView->CountItems(); i++) {
|
break;
|
||||||
BStringItem* item = (BStringItem*)fListView->ItemAt(i);
|
}
|
||||||
if (!strcmp(item->Text(), soundFont)) {
|
}
|
||||||
fListView->Select(i);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user