all repos — mgba @ 0a898f66b4c3cf63e32bc90d73dae33fee41a29a

mGBA Game Boy Advance Emulator

Util: Fix CircleBufferWrite
Vicki Pfau vi@endrift.com
Sat, 03 Jun 2017 17:25:22 -0700
commit

0a898f66b4c3cf63e32bc90d73dae33fee41a29a

parent

d240272ac4fa84d9838cfeaa85ddb0b56b8a3637

1 files changed, 1 insertions(+), 1 deletions(-)

jump to
M src/util/circle-buffer.csrc/util/circle-buffer.c

@@ -127,7 +127,7 @@ }

size_t CircleBufferWrite(struct CircleBuffer* buffer, const void* input, size_t length) { int8_t* data = buffer->writePtr; - if (buffer->size + sizeof(int16_t) > buffer->capacity) { + if (buffer->size + length > buffer->capacity) { return 0; } size_t remaining = buffer->capacity - ((int8_t*) data - (int8_t*) buffer->data);