Skip to content

Commit

Permalink
Avoid passing an null pointer to memcpy
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Mar 7, 2024
1 parent e40cd03 commit 6fb533c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/TraceStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,10 @@ TraceFrame TraceReader::read_frame(FrameTime skip_before) {
auto mprotect_records = event.getSyscallbufFlush().getMprotectRecords();
auto& records = ret.ev.SyscallbufFlush().mprotect_records;
records.resize(mprotect_records.size() / sizeof(mprotect_record));
memcpy(records.data(), mprotect_records.begin(),
records.size() * sizeof(mprotect_record));
if (records.data()) {
memcpy(records.data(), mprotect_records.begin(),
records.size() * sizeof(mprotect_record));
}
break;
}
case trace::Frame::Event::SYSCALL: {
Expand Down

0 comments on commit 6fb533c

Please sign in to comment.