tests: Test cropping of string still is NULL-terminated
diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c
index 717554d..87cb349 100644
--- a/src/tests/test-helpers.c
+++ b/src/tests/test-helpers.c
@@ -62,6 +62,11 @@
.size = 16,
};
+const OCTET_STRING_t text2 = {
+ .buf = "01234567890123456789012345678901234567890",
+ .size = 40,
+};
+
void test_asn1_helpers(void)
{
int rc;
@@ -91,6 +96,10 @@
ASSERT(rc == 16);
ASSERT(!strcmp(text, (char *)text1.buf));
+ rc = asn1_strncpy(text, &text2, sizeof(text));
+ printf("Decoding large string from asn1: %s\n", text);
+ ASSERT(rc == 31);
+
}
int main(int argc, char **argv)