summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 38f2afd)
raw | patch | inline | side by side (parent: 38f2afd)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 20 Feb 2014 21:52:02 +0000 (22:52 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 20 Feb 2014 21:52:02 +0000 (22:52 +0100) |
This is to check that sdb_data_strlen() reports sane numbers.
t/core/data_test.c | patch | blob | history |
diff --git a/t/core/data_test.c b/t/core/data_test.c
index 4d2efedd6b5b40ead3abf98c3edfda9cf32319c1..f6f9b4826c9037d993c598f832eb894d8d7b0ed1 100644 (file)
--- a/t/core/data_test.c
+++ b/t/core/data_test.c
"sdb_data_format(type=%s) used wrong format: %s; expected: %s",
SDB_TYPE_TO_STRING(datum->type), buf, golden_data[i].expected);
+ fail_unless((size_t)check <= sizeof(buf) - 2,
+ "sdb_data_format(type=%s) wrote %d bytes; "
+ "expected <= %zu based on sdb_data_strlen()",
+ SDB_TYPE_TO_STRING(datum->type), check, sizeof(buf) - 2);
+
fail_unless(buf[sizeof(buf) - 2] == '\0',
"sdb_data_format(type=%s) did not nul-terminate the buffer",
SDB_TYPE_TO_STRING(datum->type));