[haiku-commits] haiku: hrev49359 - in src: kits/tracker add-ons/kernel/file_systems/userlandfs/server/beos kits/network/libnetapi add-ons/print/drivers/pdf/source

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 3 Jul 2015 23:40:43 +0200 (CEST)

hrev49359 adds 4 changesets to branch 'master'
old head: bd97c88ac35fee3e5758f70366b2b0f28703287f
new head: 76a1eb689cdf89f5bc990c67d01959c57eb63117
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=76a1eb689cdf+%5Ebd97c88ac35f

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

5889eb7c47a3: PDF Printer: Check FlattenedSize() result for error

CID 610903

a495c5e69a3c: NetBuffer: Check result of FlattenedSize() for error

CID 610923

189c10b08993: Tracker: check result of FlattenedSize() for error

76a1eb689cdf: userlandfs: Fix access mask check

CID 1255052 and CID 1255053

[ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

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

4 files changed, 18 insertions(+), 10 deletions(-)
.../userlandfs/server/beos/BeOSKernelVolume.cpp | 4 ++--
.../print/drivers/pdf/source/PrinterSettings.cpp | 4 +++-
src/kits/network/libnetapi/NetBuffer.cpp | 6 +++++-
src/kits/tracker/Tracker.cpp | 14 ++++++++------

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

Commit: 5889eb7c47a3c0bd6b15fc7a35989d70789e9dba
URL: http://cgit.haiku-os.org/haiku/commit/?id=5889eb7c47a3
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Fri Jul 3 18:27:31 2015 UTC

PDF Printer: Check FlattenedSize() result for error

CID 610903

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

diff --git a/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp
b/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp
index 2aa0798..9658195 100644
--- a/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp
+++ b/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp
@@ -115,11 +115,13 @@ PrinterSettings::ReadSettings(BMessage *msg)
status_t
PrinterSettings::WriteSettings(BMessage* msg)
{
- size_t length;
+ ssize_t length;
char *data = NULL;
status_t err = B_ERROR;

length = msg->FlattenedSize();
+ if (length < B_OK)
+ return length;
data = (char *) malloc(length);
if (data != NULL) {
msg->Flatten(data, length);

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

Commit: a495c5e69a3c9185fd4a593a12388aa457e3af35
URL: http://cgit.haiku-os.org/haiku/commit/?id=a495c5e69a3c
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Fri Jul 3 18:31:57 2015 UTC

NetBuffer: Check result of FlattenedSize() for error

CID 610923

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

diff --git a/src/kits/network/libnetapi/NetBuffer.cpp
b/src/kits/network/libnetapi/NetBuffer.cpp
index 5bc5869..bd05a68 100644
--- a/src/kits/network/libnetapi/NetBuffer.cpp
+++ b/src/kits/network/libnetapi/NetBuffer.cpp
@@ -202,7 +202,11 @@ BNetBuffer::AppendMessage(const BMessage& data)
{
char stackFlattenedData[STACK_BUFFER_SIZE];

- size_t dataSize = data.FlattenedSize();
+ ssize_t dataSize = data.FlattenedSize();
+
+ if (dataSize < B_OK)
+ return dataSize;
+
if (dataSize == 0)
return B_ERROR;


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

Commit: 189c10b089932ebb034337d71410153d6737775d
URL: http://cgit.haiku-os.org/haiku/commit/?id=189c10b08993
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Fri Jul 3 18:48:40 2015 UTC

Tracker: check result of FlattenedSize() for error

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

diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp
index 1fae98a..18e80fe 100644
--- a/src/kits/tracker/Tracker.cpp
+++ b/src/kits/tracker/Tracker.cpp
@@ -428,12 +428,14 @@ TTracker::QuitRequested()
if (!BootedInSafeMode() && FSGetDeskDir(&deskDir) == B_OK) {
// if message is empty, delete the corresponding attribute
if (message.CountNames(B_ANY_TYPE)) {
- size_t size = (size_t)message.FlattenedSize();
- char* buffer = new char[size];
- message.Flatten(buffer, (ssize_t)size);
- deskDir.WriteAttr(kAttrOpenWindows, B_MESSAGE_TYPE, 0,
buffer,
- size);
- delete[] buffer;
+ ssize_t size = message.FlattenedSize();
+ if (size > B_OK) {
+ char* buffer = new char[size];
+ message.Flatten(buffer, size);
+ deskDir.WriteAttr(kAttrOpenWindows,
B_MESSAGE_TYPE, 0, buffer,
+ size);
+ delete[] buffer;
+ }
} else
deskDir.RemoveAttr(kAttrOpenWindows);
}

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

Revision: hrev49359
Commit: 76a1eb689cdf89f5bc990c67d01959c57eb63117
URL: http://cgit.haiku-os.org/haiku/commit/?id=76a1eb689cdf
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Fri Jul 3 20:14:09 2015 UTC

userlandfs: Fix access mask check

CID 1255052 and CID 1255053

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

diff --git
a/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp
b/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp
index 5c7202c..f37730d 100644
---
a/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp
+++
b/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp
@@ -604,7 +604,7 @@ BeOSKernelVolume::ReadAttr(void* node, void* _cookie, off_t
pos,
AttributeCookie* cookie = (AttributeCookie*)_cookie;

// check, if open mode allows reading
- if ((open_mode_to_access(cookie->fOpenMode) | R_OK) == 0)
+ if ((open_mode_to_access(cookie->fOpenMode) & R_OK) == 0)
return B_FILE_ERROR;

// read
@@ -624,7 +624,7 @@ BeOSKernelVolume::WriteAttr(void* node, void* _cookie,
off_t pos,
AttributeCookie* cookie = (AttributeCookie*)_cookie;

// check, if open mode allows writing
- if ((open_mode_to_access(cookie->fOpenMode) | W_OK) == 0)
+ if ((open_mode_to_access(cookie->fOpenMode) & W_OK) == 0)
return B_FILE_ERROR;

// write


Other related posts: