[haiku-commits] haiku: hrev49326 - in src: preferences/media bin

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 26 Jun 2015 04:44:08 +0200 (CEST)

hrev49326 adds 2 changesets to branch 'master'
old head: 6b05e9db3d4d2a79d65750e770a828c4f74acd91
new head: 2b0dad2c7e55db5f077aa54e7517177ebfc24dea
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=2b0dad2c7e55+%5E6b05e9db3d4d

----------------------------------------------------------------------------

1443b2798f25: CID 1249930: Don't scanf uninitialized buffer

Would happen in case of a missing config file, for instance.

2b0dad2c7e55: Fix segfault in Top utility

Could occur whenever the terminal exceed 96 columns (write beyond end of
string).

[ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 13 insertions(+), 13 deletions(-)
src/bin/top.cpp | 2 +-
src/preferences/media/MidiSettingsView.cpp | 24 ++++++++++++------------

############################################################################

Commit: 1443b2798f25bf30a5e1754998d66498ca0c4eb7
URL: http://cgit.haiku-os.org/haiku/commit/?id=1443b2798f25
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Thu Jun 25 23:29:13 2015 UTC

CID 1249930: Don't scanf uninitialized buffer

Would happen in case of a missing config file, for instance.

----------------------------------------------------------------------------

diff --git a/src/preferences/media/MidiSettingsView.cpp
b/src/preferences/media/MidiSettingsView.cpp
index 65b3884..5310a4d 100644
--- a/src/preferences/media/MidiSettingsView.cpp
+++ b/src/preferences/media/MidiSettingsView.cpp
@@ -130,19 +130,19 @@ MidiSettingsView::_LoadSettings()
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
path.Append(SETTINGS_FILE);
BFile file(path.Path(), B_READ_ONLY);
- if (file.InitCheck() == B_OK)
+ if (file.InitCheck() == B_OK) {
file.Read(buffer, sizeof(buffer));
- }
-
- char soundFont[512];
- sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
- soundFont);
-
- for (int32 i = 0; i < fListView->CountItems(); i++) {
- BStringItem* item = (BStringItem*)fListView->ItemAt(i);
- if (!strcmp(item->Text(), soundFont)) {
- fListView->Select(i);
- break;
+ char soundFont[512];
+ sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
+ soundFont);
+
+ for (int32 i = 0; i < fListView->CountItems(); i++) {
+ BStringItem* item =
(BStringItem*)fListView->ItemAt(i);
+ if (!strcmp(item->Text(), soundFont)) {
+ fListView->Select(i);
+ break;
+ }
+ }
}
}
}

############################################################################

Revision: hrev49326
Commit: 2b0dad2c7e55db5f077aa54e7517177ebfc24dea
URL: http://cgit.haiku-os.org/haiku/commit/?id=2b0dad2c7e55
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Fri Jun 26 02:35:06 2015 UTC

Fix segfault in Top utility

Could occur whenever the terminal exceed 96 columns (write beyond end of
string).

----------------------------------------------------------------------------

diff --git a/src/bin/top.cpp b/src/bin/top.cpp
index 0ca9e6d..bc3b963 100644
--- a/src/bin/top.cpp
+++ b/src/bin/top.cpp
@@ -216,7 +216,7 @@ compare(

if (columns <= 80)
t.name[16] = 0;
- else
+ else if (columns - 64 < sizeof(t.name))
t.name[columns - 64] = 0;

total = it->total_time();


Other related posts:

  • » [haiku-commits] haiku: hrev49326 - in src: preferences/media bin - stpere