mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-19 20:45:18 -05:00
fix(studio): avoid decoding buffer overflow (#3185)
This patch fixes studio rpc bug. Protobuf decoding buffer overflows when multiple frames are in rx buffer.
This commit is contained in:
@@ -87,7 +87,7 @@ static bool rpc_read_cb(pb_istream_t *stream, uint8_t *buf, size_t count) {
|
||||
|
||||
do {
|
||||
uint8_t *buffer;
|
||||
uint32_t len = ring_buf_get_claim(&rpc_rx_buf, &buffer, count);
|
||||
uint32_t len = ring_buf_get_claim(&rpc_rx_buf, &buffer, count - write_offset);
|
||||
|
||||
if (len > 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
Reference in New Issue
Block a user