mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 06:33:51 +00:00 
			
		
		
		
	Fixes sml parser to process extended length lists with a number of items that is dividable by 16 (#6148)
This commit is contained in:
		
				
					committed by
					
						 Jesse Hills
						Jesse Hills
					
				
			
			
				
	
			
			
			
						parent
						
							5bec0a6534
						
					
				
				
					commit
					4690e227b8
				
			| @@ -27,7 +27,7 @@ bool SmlFile::setup_node(SmlNode *node) { | ||||
|   uint8_t parse_length = length; | ||||
|   if (has_extended_length) { | ||||
|     length = (length << 4) + (this->buffer_[this->pos_ + 1] & 0x0f); | ||||
|     parse_length = length - 1; | ||||
|     parse_length = length; | ||||
|     this->pos_ += 1; | ||||
|   } | ||||
|  | ||||
| @@ -37,7 +37,9 @@ bool SmlFile::setup_node(SmlNode *node) { | ||||
|   node->type = type & 0x07; | ||||
|   node->nodes.clear(); | ||||
|   node->value_bytes.clear(); | ||||
|   if (this->buffer_[this->pos_] == 0x00) {  // end of message | ||||
|  | ||||
|   // if the list is a has_extended_length list with e.g. 16 elements this is a 0x00 byte but not the end of message | ||||
|   if (!has_extended_length && this->buffer_[this->pos_] == 0x00) {  // end of message | ||||
|     this->pos_ += 1; | ||||
|   } else if (is_list) {  // list | ||||
|     this->pos_ += 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user