Skip to content

Commit

Permalink
In FprimeProtocol.cpp:deframe(), make buffer no larger than requested…
Browse files Browse the repository at this point in the history
… (as is possible with static memory allocator) (#822)

Co-authored-by: Neil Abcouwer <neil.abcouwer@jpl.nasa.gov>
  • Loading branch information
nabcouwer and abcouwer-jpl authored Jul 14, 2021
1 parent 2a96785 commit a56ca7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Svc/FramingProtocol/FprimeProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ DeframingProtocol::DeframingStatus FprimeDeframing::deframe(Types::CircularBuffe
return DeframingProtocol::DEFRAMING_INVALID_CHECKSUM;
}
Fw::Buffer buffer = m_interface->allocate(size);
// some allocators may return buffers larger than requested
// that causes issues in routing. adjust size
FW_ASSERT(buffer.getSize() >= size);
buffer.setSize(size);
ring.peek(buffer.getData(), size, FP_FRAME_HEADER_SIZE);
m_interface->route(buffer);
return DeframingProtocol::DEFRAMING_STATUS_SUCCESS;
Expand Down

0 comments on commit a56ca7c

Please sign in to comment.