fix (stream): fixed bug that allowed reading nonexistent data

This commit is contained in:
antifallobst 2023-05-02 00:42:09 +02:00
parent 0c084d00c0
commit d493ebc64f
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,6 @@ void stream_destruct(stream_T* stream) {
memory_free(stream);
}
#include "utils/logger.h"
uint32_t stream_write(stream_T* stream, void* buffer_in, uint32_t n) {
uint32_t num_top;
uint32_t num_bottom;
@ -43,6 +41,8 @@ uint32_t stream_write(stream_T* stream, void* buffer_in, uint32_t n) {
}
uint32_t stream_read(stream_T* stream, void* buffer_out, uint32_t n) {
if (stream->pos_sender == stream->pos_receiver) return 0;
uint32_t num_top;
uint32_t num_bottom;