diff options
author | Samuel O'Brien <sam.obrien@ni.com> | 2020-07-13 16:11:42 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-07-16 07:28:15 -0500 |
commit | be6491428db599867129733f73e7ce0ce23e05a7 (patch) | |
tree | 929ae62f57a57f669edaaa7ad4186d83416a8502 /host/cmake | |
parent | b2527716000284eaaaeff9d6c51241c5392e92f6 (diff) | |
download | uhd-be6491428db599867129733f73e7ce0ce23e05a7.tar.gz uhd-be6491428db599867129733f73e7ce0ce23e05a7.tar.bz2 uhd-be6491428db599867129733f73e7ce0ce23e05a7.zip |
chdr: Assert Ctrl Packet Size Before Serializing
This commit alters the ctrl_payload#serialize function to assert the
serialized length of the packet fits inside the buffer before writing.
Originally, the function writes the data and then asserts that the final
pointer position isn't further than the end of the buffer. While this
works, if it were to fail, that means we have already caused undefined
behavior by writing to some random memory location, which isn't good
practice.
This commit is possible now that the get_length method exists.
Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'host/cmake')
0 files changed, 0 insertions, 0 deletions