Skip to content

Commit c0a6b27

Browse files
Earle F. Philhower, IIIEarle F. Philhower, III
authored andcommitted
Fix string max length check
We only have 15, not 16, bits of length, so adjust the check accordingly.
1 parent de3d258 commit c0a6b27

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp8266/WString.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ unsigned char String::reserve(unsigned int size) {
153153
}
154154

155155
unsigned char String::changeBuffer(unsigned int maxStrLen) {
156-
if (maxStrLen > 0xffff) {
157-
// Sanity check len can fit in 16-bits
156+
if (maxStrLen > 0x7fff) {
157+
// Sanity check len can fit in 15-bits
158158
return 0;
159159
}
160160
// Can we use SSO here to avoid allocation?

0 commit comments

Comments
 (0)