diff options
author | Kenny Root <kroot@google.com> | 2014-03-17 21:28:34 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-17 21:28:34 +0000 |
commit | 38e2aaaa3dd62a20eb211808ae6fe45ec37ee6d5 (patch) | |
tree | 8566ba215cdf3cfea5c5defac1de8ea210c23391 /libs/binder | |
parent | 7cd122a549831611ce79389e481484ade16744f1 (diff) | |
parent | 5b61ad2cda8ec8ab634ce02f388bb2d3c5ab048d (diff) | |
download | frameworks_native-38e2aaaa3dd62a20eb211808ae6fe45ec37ee6d5.zip frameworks_native-38e2aaaa3dd62a20eb211808ae6fe45ec37ee6d5.tar.gz frameworks_native-38e2aaaa3dd62a20eb211808ae6fe45ec37ee6d5.tar.bz2 |
am 5b61ad2c: Check the padded size of the read byte array
* commit '5b61ad2cda8ec8ab634ce02f388bb2d3c5ab048d':
Check the padded size of the read byte array
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/Parcel.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 17ffa05..db9e0a1 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -908,7 +908,8 @@ void Parcel::remove(size_t start, size_t amt) status_t Parcel::read(void* outData, size_t len) const { - if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { + if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize + && len <= PAD_SIZE(len)) { memcpy(outData, mData+mDataPos, len); mDataPos += PAD_SIZE(len); ALOGV("read Setting data pos of %p to %d\n", this, mDataPos); @@ -919,7 +920,8 @@ status_t Parcel::read(void* outData, size_t len) const const void* Parcel::readInplace(size_t len) const { - if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { + if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize + && len <= PAD_SIZE(len)) { const void* data = mData+mDataPos; mDataPos += PAD_SIZE(len); ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos); |