string-util: check for overflow in strrep()

This simply mirrors the same overflow check we already have in
strrepa(), in case someone passed us a sufficiently long string.

strrep() is currently used only in tests, so this is just hardening.
This commit is contained in:
Frantisek Sumsal
2026-04-16 17:46:31 +02:00
parent 4efb5d389c
commit b22daa97e1
3 changed files with 14 additions and 7 deletions
+2
View File
@@ -325,6 +325,8 @@ TEST(strrep) {
ASSERT_STREQ(onea, "waldo");
ASSERT_STREQ(threea, "waldowaldowaldo");
ASSERT_NULL(strrep("waldo", SIZE_MAX - 1));
}
TEST(string_has_cc) {