Skip to content

Commit b02c520

Browse files
committed
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)); } (Filtered from arduino/Arduino@91f0dbc)
1 parent 6593f9f commit b02c520

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/Stream.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi
7575
// find returns true if the target string is found
7676
bool Stream::find(char *target)
7777
{
78-
return findUntil(target, NULL);
78+
return findUntil(target, "");
7979
}
8080

8181
// reads data from the stream until the target string of given length is found

0 commit comments

Comments
 (0)