Skip to content

Commit 40c98b2

Browse files
authored
[Client] Fix for truncation of strings with null in writeValue std::string overload
1 parent f48f3b1 commit 40c98b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/NimBLERemoteCharacteristic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ std::string NimBLERemoteCharacteristic::toString() {
712712
* @return false if not connected or cant perform write for some reason.
713713
*/
714714
bool NimBLERemoteCharacteristic::writeValue(const std::string &newValue, bool response) {
715-
return writeValue((uint8_t*)newValue.c_str(), strlen(newValue.c_str()), response);
715+
return writeValue((uint8_t*)newValue.c_str(), newValue.length(), response);
716716
} // writeValue
717717

718718

0 commit comments

Comments
 (0)