8000 Fixed exception when using Flash strings as object keys (fixes #784) · java64/ArduinoJson@3f666bd · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f666bd

Browse files
committed
Fixed exception when using Flash strings as object keys (fixes bblanchon#784)
1 parent d53a93e commit 3f666bd

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
ArduinoJson: change log
22
=======================
33

4+
HEAD
5+
----
6+
7+
* Fixed exception when using Flash strings as object keys (issue #784)
8+
49
v6.2.2-beta
510
-----------
611

src/ArduinoJson/Strings/FixedSizeFlashString.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class FixedSizeFlashString {
1515
bool equals(const char* expected) const {
1616
const char* actual = reinterpret_cast<const char*>(_str);
1717
if (!actual || !expected) return actual == expected;
18-
return strcmp_P(actual, expected) == 0;
18+
return strncmp_P(expected, actual, _size) == 0;
1919
}
2020

2121
bool is_null() const {

src/ArduinoJson/Strings/ZeroTerminatedFlashString.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ZeroTerminatedFlashString {
1414
bool equals(const char* expected) const {
1515
const char* actual = reinterpret_cast<const char*>(_str);
1616
if (!actual || !expected) return actual == expected;
17-
return strcmp_P(actual, expected) == 0;
17+
return strcmp_P(expected, actual) == 0;
1818
}
1919

2020
bool is_null() const {

0 commit comments

Comments
 (0)
0