OSDN Git Service

Don't pad before calling writeInPlace().
authorMartijn Coenen <maco@google.com>
Wed, 4 Apr 2018 09:46:56 +0000 (11:46 +0200)
committerAtanas Kirilov <akirilov@google.com>
Mon, 16 Apr 2018 18:57:32 +0000 (18:57 +0000)
writeInplace() itself already pads securely, by masking off
the padded bytes. If the padding is done before calling
writeInplace(), no mask is applied, and heap data can leak.

Bug: 77237570
Test: builds
Change-Id: Ide27a0002d4ed4196530430760245b971f6a3f44
Merged-In: Ide27a0002d4ed4196530430760245b971f6a3f44

(cherry picked from commit f8542381b72a7bb2452a5278a00ca8c34edbf8a0)

libs/binder/Parcel.cpp

index cfcf73b..4d6ea88 100644 (file)
@@ -985,7 +985,7 @@ status_t Parcel::write(const FlattenableHelperInterface& val)
     if (err) return err;
 
     // payload
-    void* const buf = this->writeInplace(pad_size(len));
+    void* const buf = this->writeInplace(len);
     if (buf == NULL)
         return BAD_VALUE;