Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Unified Diff: dbus/message.cc

Issue 8525012: dbus: Fix a bug where we rejected an empty array in PopArrayOfBytes() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor change Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dbus/message_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/message.cc
diff --git a/dbus/message.cc b/dbus/message.cc
index aa9cc550e46ce792db8fdb1a4289d80fa7933865..2750cb187a08329d1e196c6d54817d41180ee54b 100644
--- a/dbus/message.cc
+++ b/dbus/message.cc
@@ -755,6 +755,12 @@ bool MessageReader::PopArrayOfBytes(uint8** bytes, size_t* length) {
MessageReader array_reader(message_);
if (!PopArray(&array_reader))
return false;
+ // An empty array is allowed.
+ if (!array_reader.HasMoreData()) {
+ *length = 0;
+ *bytes = NULL;
+ return true;
+ }
if (!array_reader.CheckDataType(DBUS_TYPE_BYTE))
return false;
int int_length = 0;
@@ -762,7 +768,7 @@ bool MessageReader::PopArrayOfBytes(uint8** bytes, size_t* length) {
bytes,
&int_length);
*length = static_cast<int>(int_length);
- return bytes != NULL;
+ return true;
}
bool MessageReader::PopArrayOfStrings(
« no previous file with comments | « no previous file | dbus/message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698