libobs/util: Fix bug with circlebuf_data

If the index specified is equal to the size of the data, return NULL.
This commit is contained in:
jp9000
2019-02-05 00:26:27 -08:00
parent 9b8bc22ffa
commit e6c719a1dd

View File

@@ -311,7 +311,7 @@ static inline void *circlebuf_data(struct circlebuf *cb, size_t idx)
uint8_t *ptr = (uint8_t*)cb->data;
size_t offset = cb->start_pos + idx;
if (idx > cb->size)
if (idx >= cb->size)
return NULL;
if (offset >= cb->capacity)