TESTS: ist: fix wrong array size

test_istzero() and test_istpad() has the wrong array size buf[] which
lacks the space for the '\0';

Could be backported in every stable branches.
This commit is contained in:
William Lallemand 2025-03-04 10:47:08 +01:00
parent 937ece45d4
commit ddd2c82a35

View File

@ -68,7 +68,7 @@ int test_istnext()
struct ist f_istpad(void *buf, const struct ist ist) { return istpad(buf, ist); } struct ist f_istpad(void *buf, const struct ist ist) { return istpad(buf, ist); }
int test_istpad() int test_istpad()
{ {
char buf[5] = "xxxxx"; char buf[6] = "xxxxx";
if (strncmp(istpad(buf, ist("foo")).ptr, "foo", 3) != 0) if (strncmp(istpad(buf, ist("foo")).ptr, "foo", 3) != 0)
return __LINE__; return __LINE__;
@ -106,7 +106,7 @@ int test_isttrim()
struct ist f_istzero(struct ist ist, size_t size) { return istzero(ist, size); } struct ist f_istzero(struct ist ist, size_t size) { return istzero(ist, size); }
int test_istzero() int test_istzero()
{ {
char buf[5] = "xxxxx"; char buf[6] = "xxxxx";
if (istzero(ist2(buf, 5), 10).ptr != buf) if (istzero(ist2(buf, 5), 10).ptr != buf)
return __LINE__; return __LINE__;