mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
Fix of a bug
Stream::find(char *target) passes NULL as “terminator” to Stream::findUntil(char *target, char *terminator), which immediately dereferences it by passing it on to strlen(): bool Stream::find(char *target) { return findUntil(target, NULL); } // as find but search ends if the terminator string is found bool Stream::findUntil(char *target, char *terminator) { return findUntil(target, strlen(target), terminator, strlen(terminator)); }
This commit is contained in:
parent
44b5096e05
commit
91f0dbc9ec
@ -75,7 +75,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi
|
|||||||
// find returns true if the target string is found
|
// find returns true if the target string is found
|
||||||
bool Stream::find(char *target)
|
bool Stream::find(char *target)
|
||||||
{
|
{
|
||||||
return findUntil(target, NULL);
|
return findUntil(target, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// reads data from the stream until the target string of given length is found
|
// reads data from the stream until the target string of given length is found
|
||||||
|
Loading…
x
Reference in New Issue
Block a user