mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
Fix cbuf running out of bounds (#348)
This commit is contained in:
parent
a49dd45538
commit
2a297ca171
@ -95,7 +95,7 @@ class cbuf {
|
||||
size_t bytes_available = room();
|
||||
size_t size_to_write = (size < bytes_available) ? size : bytes_available;
|
||||
size_t size_written = size_to_write;
|
||||
if(_end > _begin && size_to_write > (size_t)(_bufend - _end)) {
|
||||
if(_end >= _begin && size_to_write > (size_t)(_bufend - _end)) {
|
||||
size_t top_size = _bufend - _end;
|
||||
memcpy(_end, src, top_size);
|
||||
_end = _buf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user