In WString.cpp some of the methods access the insecure version of strcmp and strcnmp
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 13.1k
- PR merge metrics
- No merged PRs in 30d
Description
1.In brief: in the String class of the WString.cpp library, the following method responses access string comparison functions (`strcmp()` and `strcnmp()`) that are not ESP8266-safe:
- `bool String::endsWith(const String &s2) const`;
- `bool String::equals(const char *cstr) const`;
- `int String::compareTo(const String &s) const`;
- `bool String::startsWith(const String &s2, unsigned int offset) const`.
2.Problem description: because the listed methods use functions that cannot work with strings in external ROM, an exception (3) occurs when working with the specified methods for strings declared as `F()` or `PSTR()`.
3.An example that will result in exception (3): `if(someString.equals(PSTR("eqString")) {// todo something}` >>> exception (3): in console log.
4.Solution: replace `strcmp()` with `strcmp_P()`, `strcnmp()` with `strcnmp_P()`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.