From df97c582d7ab9bbb6734a82f5ca123405866c4e0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 23 Mar 2022 16:48:17 +0100 Subject: [PATCH] possibly important fix for ring buffer write --- src/fsfw/container/SimpleRingBuffer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp index bcf3cf20..0c95fe40 100644 --- a/src/fsfw/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -48,6 +48,9 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) { } ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { + if(amount > maxSize()) { + return HasReturnvaluesIF::RETURN_FAILED; + } if (availableWriteSpace() >= amount or overwriteOld) { size_t amountTillWrap = writeTillWrap(); if (amountTillWrap >= amount) {