mirror of
				https://github.com/thelsing/knx.git
				synced 2025-10-26 10:26:25 +01:00 
			
		
		
		
	Try fixing a crash due to NULL derefence (#77)
* fix crash due to NULL _sendBuffer Co-authored-by: etrinh <etrinh@zdionline.net>
This commit is contained in:
		
							parent
							
								
									ffea53614b
								
							
						
					
					
						commit
						52d3866e41
					
				| @ -2,6 +2,10 @@ | ||||
| #include <string.h> | ||||
| #include "bits.h" | ||||
| 
 | ||||
| #ifndef KNX_FLASH_SIZE | ||||
| # define KNX_FLASH_SIZE 8192 | ||||
| #endif | ||||
| 
 | ||||
| Memory::Memory(Platform& platform, DeviceObject& deviceObject) | ||||
|     : _platform(platform), _deviceObject(deviceObject) | ||||
| { | ||||
| @ -13,7 +17,7 @@ void Memory::readMemory() | ||||
|     if (_data != nullptr) | ||||
|         return; | ||||
| 
 | ||||
|     uint16_t flashSize = 8192; | ||||
|     uint16_t flashSize = KNX_FLASH_SIZE; | ||||
|     _data = _platform.getEepromBuffer(flashSize); | ||||
| 
 | ||||
|     printHex("RESTORED ", _data, _metadataSize); | ||||
|  | ||||
| @ -245,7 +245,7 @@ void TpUartDataLinkLayer::loop() | ||||
|                 //Destination Address + payload available
 | ||||
|                 _xorSum ^= rxByte; | ||||
|                 //check if echo
 | ||||
|                 if (!((buffer[0] ^ _sendBuffer[0]) & ~0x20) && !memcmp(buffer + _convert + 1, _sendBuffer + 1, 5)) | ||||
|                 if (_sendBuffer != nullptr && (!((buffer[0] ^ _sendBuffer[0]) & ~0x20) && !memcmp(buffer + _convert + 1, _sendBuffer + 1, 5))) | ||||
|                 { //ignore repeated bit of control byte
 | ||||
|                     _isEcho = true; | ||||
|                 } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user