mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Avoid copying past end of buffer in String.concat (#8198)
This commit is contained in:
committed by
GitHub
parent
a105bdd359
commit
2946ce055c
@ -594,3 +594,13 @@ TEST_CASE("String chaining", "[core][String]")
|
||||
REQUIRE(static_cast<const void*>(result.c_str()) == static_cast<const void*>(ptr));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("String concat OOB #8198", "[core][String]")
|
||||
{
|
||||
char *p = (char*)malloc(16);
|
||||
memset(p, 'x', 16);
|
||||
String s = "abcd";
|
||||
s.concat(p, 16);
|
||||
REQUIRE(!strcmp(s.c_str(), "abcdxxxxxxxxxxxxxxxx"));
|
||||
free(p);
|
||||
}
|
||||
|
Reference in New Issue
Block a user