diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-01-18 19:47:37 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-01-18 19:47:37 +0300 |
commit | 3c5f7de7f0fcc96e64b5710a738e18190c1979b9 (patch) | |
tree | f5942462994e01a332187318a9dec9515b3f3335 /src | |
parent | a5c9e4b6067e8594b7cee4ec5aa38f25635a9a70 (diff) |
Fix possible overflow when commands are queued for deferred processing
Diffstat (limited to 'src')
-rw-r--r-- | src/GCodes/GCodeQueue.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/GCodes/GCodeQueue.cpp b/src/GCodes/GCodeQueue.cpp index cf11c03b..e2eb6fa2 100644 --- a/src/GCodes/GCodeQueue.cpp +++ b/src/GCodes/GCodeQueue.cpp @@ -253,8 +253,8 @@ void QueuedCode::AssignFrom(GCodeBuffer &gb) noexcept #if HAS_SBC_INTERFACE isBinary = gb.IsBinary(); #endif - memcpy(data, gb.DataStart(), gb.DataLength()); - dataLength = gb.DataLength(); + dataLength = min<size_t>(gb.DataLength(), sizeof(data)); + memcpy(data, gb.DataStart(), dataLength); } void QueuedCode::AssignTo(GCodeBuffer *gb) noexcept |