diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2010-12-28 11:25:50 -0800 |
|---|---|---|
| committer | Android Code Review <code-review@android.com> | 2010-12-28 11:25:50 -0800 |
| commit | bfb5f5966b36c4960b56f6de10ba261332208db9 (patch) | |
| tree | 0a72584eecbd1a1571aa22c9e322f19e7036fdf4 | |
| parent | 752942ec4719e6a274d6ab11103ac28459cb0f0c (diff) | |
| parent | b803c04cdaf3ce9dec387a874cabf141f0d8500f (diff) | |
| download | frameworks_base-bfb5f5966b36c4960b56f6de10ba261332208db9.zip frameworks_base-bfb5f5966b36c4960b56f6de10ba261332208db9.tar.gz frameworks_base-bfb5f5966b36c4960b56f6de10ba261332208db9.tar.bz2 | |
Merge "Fix for writing empty strings to Parcel::writeString8()"
| -rw-r--r-- | libs/binder/Parcel.cpp | 5 |
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; |
