summaryrefslogtreecommitdiffstats
path: root/libs/binder
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2010-12-28 11:54:08 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-12-28 11:54:08 -0800
commit827521a8e3fe0bedc8624657f624cf2f9dab58e1 (patch)
treeee8dcdc18b7121bf096f6bf761cf01cc2da2c60d /libs/binder
parent55985bed7be8c93296eee3f4f39557fba4fbaebe (diff)
parent6637e307494475b85afe8869d312d4a2f832d8f4 (diff)
downloadframeworks_base-827521a8e3fe0bedc8624657f624cf2f9dab58e1.zip
frameworks_base-827521a8e3fe0bedc8624657f624cf2f9dab58e1.tar.gz
frameworks_base-827521a8e3fe0bedc8624657f624cf2f9dab58e1.tar.bz2
am 6637e307: am bfb5f596: Merge "Fix for writing empty strings to Parcel::writeString8()"
* commit '6637e307494475b85afe8869d312d4a2f832d8f4': Fix for writing empty strings to Parcel::writeString8()
Diffstat (limited to 'libs/binder')
-rw-r--r--libs/binder/Parcel.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index f329ac4..d57f2c9 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -619,7 +619,10 @@ status_t Parcel::writeCString(const char* str)
status_t Parcel::writeString8(const String8& str)
{
status_t err = writeInt32(str.bytes());
- if (err == NO_ERROR) {
+ // only write string if its length is more than zero characters,
+ // as readString8 will only read if the length field is non-zero.
+ // this is slightly different from how writeString16 works.
+ if (str.bytes() > 0 && err == NO_ERROR) {
err = write(str.string(), str.bytes()+1);
}
return err;