@@ -292,23 +292,27 @@ CHIP_ERROR emberAfSetDynamicEndpoint(uint16_t index, EndpointId id, const EmberA
292
292
}
293
293
}
294
294
295
- for (uint8_t i = 0 ; ep && (i < ep->clusterCount ); i++) {
296
- if (!ep->cluster ) {
295
+ for (uint8_t i = 0 ; ep && (i < ep->clusterCount ); i++)
296
+ {
297
+ if (!ep->cluster )
298
+ {
297
299
continue ;
298
300
}
299
301
300
302
const EmberAfCluster * cluster = &(ep->cluster [i]);
301
- if (!cluster->attributes ) {
303
+ if (!cluster->attributes )
304
+ {
302
305
continue ;
303
306
}
304
307
305
- for (uint16_t j = 0 ; j < cluster->attributeCount ; j++) {
308
+ for (uint16_t j = 0 ; j < cluster->attributeCount ; j++)
309
+ {
306
310
const EmberAfAttributeMetadata * attr = &(cluster->attributes [j]);
307
- if (emberAfAttributeSize (attr) > gEmberAttributeIOBufferSpan .size ()) {
308
- ChipLogError (
309
- DataManagement,
310
- " Attribute %u (id=" ChipLogFormatMEI " ) of Cluster %u (id=" ChipLogFormatMEI " ) too large" ,
311
- j, ChipLogValueMEI (attr->attributeId ), i, ChipLogValueMEI (cluster->clusterId ));
311
+ if (emberAfAttributeSize (attr) > chip::app::Compatibility::Internal:: gEmberAttributeIOBufferSpan .size ())
312
+ {
313
+ ChipLogError ( DataManagement,
314
+ " Attribute %u (id=" ChipLogFormatMEI " ) of Cluster %u (id=" ChipLogFormatMEI " ) too large" , j ,
315
+ ChipLogValueMEI (attr->attributeId ), i, ChipLogValueMEI (cluster->clusterId ));
312
316
return CHIP_ERROR_NO_MEMORY;
313
317
}
314
318
}
@@ -661,18 +665,20 @@ Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord,
661
665
// Is the attribute externally stored?
662
666
if (am->mask & ATTRIBUTE_MASK_EXTERNAL_STORAGE)
663
667
{
664
- if (write ) {
665
- return emberAfExternalAttributeWriteCallback (attRecord->endpoint , attRecord->clusterId ,
666
- am, buffer);
668
+ if (write )
669
+ {
670
+ return emberAfExternalAttributeWriteCallback (attRecord->endpoint , attRecord->clusterId , am,
671
+ buffer);
667
672
}
668
673
669
- if (readLength < emberAfAttributeSize (am)) {
674
+ if (readLength < emberAfAttributeSize (am))
675
+ {
670
676
// Prevent a potential buffer overflow
671
677
return Status::ResourceExhausted;
672
678
}
673
679
674
- return emberAfExternalAttributeReadCallback (attRecord->endpoint , attRecord->clusterId ,
675
- am, buffer, emberAfAttributeSize (am));
680
+ return emberAfExternalAttributeReadCallback (attRecord->endpoint , attRecord->clusterId , am,
681
+ buffer, emberAfAttributeSize (am));
676
682
}
677
683
678
684
// Internal storage is only supported for fixed endpoints
0 commit comments