diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2015-11-23 15:50:06 +0100 |
---|---|---|
committer | Daniel Willmann <dwillmann@sysmocom.de> | 2015-11-23 15:59:02 +0100 |
commit | 8ea918d772ec2e9eac460844c0c66f829dfa9c97 (patch) | |
tree | 8cc46c770bfc93d38fdfe3e8c5b014fdfac5b7a3 /src | |
parent | 53018e937cf3f07c19dbc4e58ffad699213d408f (diff) |
tests: Test cropping of string still is NULL-terminated
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/test-helpers.c | 9 |
1 files changed, 9 insertions, 0 deletions
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 @@ const OCTET_STRING_t text1 = { .size = 16, }; +const OCTET_STRING_t text2 = { + .buf = "01234567890123456789012345678901234567890", + .size = 40, +}; + void test_asn1_helpers(void) { int rc; @@ -91,6 +96,10 @@ void test_asn1_helpers(void) 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) |