Skip to content

Commit c277395

Browse files
author
Waldemar Porscha
committed
HOTFIX: DPT16 was not correctly handled for uninitialized KOs
1 parent f6111d3 commit c277395

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/knx/dpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ unsigned char Dpt::sizeInMemory() const
7272
case 275:
7373
return 8;
7474
case 16:
75-
return 15; // terminating with 0x00 char
75+
return 14;
7676
case 285:
7777
return 16;
7878
default:

src/knx/group_object.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,9 @@ void GroupObject::recalculateDataLength(const Dpt& type)
293293
_dataLength = sizeInMemory;
294294
if (_data)
295295
delete[] _data;
296-
_data = new uint8_t[_dataLength];
297-
memset(_data, 0, _dataLength);
296+
if (type.mainGroup == 16) sizeInMemory++;
297+
_data = new uint8_t[sizeInMemory];
298+
memset(_data, 0, sizeInMemory);
298299
}
299300
}
300301

0 commit comments

Comments
 (0)