mirror of
https://github.com/esphome/esphome.git
synced 2026-10-05 02:21:30 +00:00
[rc522][sml][kamstrup_kmp] Fix buffer bounds checks (#14515)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
co-authored by
Claude Opus 4.6
J. Nick Koston
parent
6f0460b0ee
commit
05ddc85412
@@ -35,6 +35,8 @@ bool SmlFile::setup_node(SmlNode *node) {
|
||||
|
||||
// Check if we need additional length bytes
|
||||
if (overlength) {
|
||||
if (this->pos_ + 1 >= this->buffer_.size())
|
||||
return false;
|
||||
// Shift the current length to the higher nibble
|
||||
// and add the lower nibble of the next byte to the length
|
||||
length = (length << 4) + (this->buffer_[this->pos_ + 1] & 0x0f);
|
||||
|
||||
Reference in New Issue
Block a user