Skip to content

Commit cb35772

Browse files
committed
Added a null terminator check
Without this check the comparison of the String "Hello World!" and the flash String "Hello World!something" would return 1.
1 parent c780997 commit cb35772

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hardware/arduino/cores/arduino/WString.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ unsigned char String::equals(const __FlashStringHelper *fstr) const
463463
if (buffer[i] != (char)pgm_read_byte(p++)) return 0;
464464
}
465465

466+
if (pgm_read_byte(p) != 0) return 0;
467+
466468
return 1;
467469
}
468470

0 commit comments

Comments
 (0)