diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index f79f80f8bd5c8a..f0762ef631749b 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -230,7 +230,8 @@ EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::Attribut } else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2)) { - *buffer = (uint16_t) ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; + uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; + memcpy(buffer, &rev, sizeof(rev)); } else { @@ -250,7 +251,8 @@ EmberAfStatus HandleReadOnOffAttribute(Device * dev, chip::AttributeId attribute } else if ((attributeId == OnOff::Attributes::ClusterRevision::Id) && (maxReadLength == 2)) { - *buffer = (uint16_t) ZCL_ON_OFF_CLUSTER_REVISION; + uint16_t rev = ZCL_ON_OFF_CLUSTER_REVISION; + memcpy(buffer, &rev, sizeof(rev)); } else { diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 3fae757c736ff8..314036a83c5dcd 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -500,11 +500,13 @@ EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::Attribut } else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2)) { - *buffer = (uint16_t) ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; + uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; + memcpy(buffer, &rev, sizeof(rev)); } else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4)) { - *buffer = (uint32_t) ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP; + uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP; + memcpy(buffer, &featureMap, sizeof(featureMap)); } else { @@ -524,7 +526,8 @@ EmberAfStatus HandleReadOnOffAttribute(DeviceOnOff * dev, chip::AttributeId attr } else if ((attributeId == OnOff::Attributes::ClusterRevision::Id) && (maxReadLength == 2)) { - *buffer = (uint16_t) ZCL_ON_OFF_CLUSTER_REVISION; + uint16_t rev = ZCL_ON_OFF_CLUSTER_REVISION; + memcpy(buffer, &rev, sizeof(rev)); } else {