Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2022-01-18 19:47:37 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-01-18 19:47:37 +0300
commit3c5f7de7f0fcc96e64b5710a738e18190c1979b9 (patch)
treef5942462994e01a332187318a9dec9515b3f3335 /src
parenta5c9e4b6067e8594b7cee4ec5aa38f25635a9a70 (diff)
Fix possible overflow when commands are queued for deferred processing
Diffstat (limited to 'src')
-rw-r--r--src/GCodes/GCodeQueue.cpp4
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