We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 752942e + b803c04 commit bfb5f59Copy full SHA for bfb5f59
libs/binder/Parcel.cpp
@@ -619,7 +619,10 @@ status_t Parcel::writeCString(const char* str)
619
status_t Parcel::writeString8(const String8& str)
620
{
621
status_t err = writeInt32(str.bytes());
622
- if (err == NO_ERROR) {
+ // only write string if its length is more than zero characters,
623
+ // as readString8 will only read if the length field is non-zero.
624
+ // this is slightly different from how writeString16 works.
625
+ if (str.bytes() > 0 && err == NO_ERROR) {
626
err = write(str.string(), str.bytes()+1);
627
}
628
return err;
0 commit comments