Skip to content

Commit 5d56313

Browse files
committed
fix: correct byte size calculation for ATT values set from containers
1 parent 5dad893 commit 5d56313

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/NimBLEAttValue.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ class NimBLEAttValue {
283283
typename std::enable_if<Has_data_size<T>::value, bool>::type
284284
# endif
285285
setValue(const T& v) {
286-
return setValue(reinterpret_cast<const uint8_t*>(v.data()), v.size());
286+
return setValue(
287+
reinterpret_cast<const uint8_t*>(v.data()),
288+
v.size() * sizeof(typename T::value_type{}) // Calculate effective size in bytes
289+
);
287290
}
288291

289292
# else

0 commit comments

Comments
 (0)