diff options
author | xshu <xshu@google.com> | 2017-09-29 14:05:32 -0700 |
---|---|---|
committer | xshu <xshu@google.com> | 2017-10-05 10:44:26 -0700 |
commit | 31aa7aa6c88ca932a61968025c2dab354d8c14d1 (patch) | |
tree | 483a68a55a4847e96c50aa5054f8e68bdf8cdeea /command_processor.cpp | |
parent | 6e5a94db8d7dc577a135cc81d80e0bdf39d42780 (diff) | |
download | wifilogd-31aa7aa6c88ca932a61968025c2dab354d8c14d1.tar.gz |
Fix memory corruption by changing refs to Objects
The memory corruption is caused by temporary Objects which where
binding to references getting destroyed before they were expected
to. This caused the references to point to corrupted memory.
This fix make the temporary Objects be assigned to Objects instead.
Bug: 66968282
Test: run ./system/connectivity/wifilogd/runtests.sh
Change-Id: If7a14326a663df554a5de9a812422e21b888edf6
Diffstat (limited to 'command_processor.cpp')
-rw-r--r-- | command_processor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/command_processor.cpp b/command_processor.cpp index b969bb4..ea223af 100644 --- a/command_processor.cpp +++ b/command_processor.cpp @@ -186,12 +186,12 @@ bool CommandProcessor::CopyCommandToLog(const void* command_buffer, } CHECK(current_log_buffer_.CanFitNow(total_size)); - const auto& tstamp_header = + const auto tstamp_header = TimestampHeader() .set_since_boot_awake_only(os_->GetTimestamp(CLOCK_MONOTONIC)) .set_since_boot_with_sleep(os_->GetTimestamp(CLOCK_BOOTTIME)) .set_since_epoch(os_->GetTimestamp(CLOCK_REALTIME)); - const auto& message_buf = + const auto message_buf = ByteBuffer<sizeof(TimestampHeader) + protocol::kMaxMessageSize>() .AppendOrDie(&tstamp_header, sizeof(tstamp_header)) .AppendOrDie(command_buffer, command_len); |