summaryrefslogtreecommitdiff
path: root/regress/lib/libcrypto
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2022-02-20 13:47:54 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2022-02-20 13:47:54 +0000
commit9eedcacfcbdb56a5b3cd044a01bac47707381e2f (patch)
tree4ce347d4b3e3b8541d26960e5fb192a4ff85439e /regress/lib/libcrypto
parent7ad6433af41625edb1252615d1e24a3bd205ec47 (diff)
Test OBJ_obj2txt() with NULL and short buffers.
Diffstat (limited to 'regress/lib/libcrypto')
-rw-r--r--regress/lib/libcrypto/objects/objectstest.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/regress/lib/libcrypto/objects/objectstest.c b/regress/lib/libcrypto/objects/objectstest.c
index 9f28b6329a5..597373efd29 100644
--- a/regress/lib/libcrypto/objects/objectstest.c
+++ b/regress/lib/libcrypto/objects/objectstest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: objectstest.c,v 1.4 2022/02/12 12:42:19 jsing Exp $ */
+/* $OpenBSD: objectstest.c,v 1.5 2022/02/20 13:47:53 jsing Exp $ */
/*
* Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org>
*
@@ -290,6 +290,17 @@ obj_oid_test(struct obj_test *ot)
goto failed;
}
+ if ((OBJ_obj2txt(NULL, 0, obj, 1) != len)) {
+ fprintf(stderr, "FAIL: OBJ_obj2txt() with NULL buffer != %d\n",
+ len);
+ goto failed;
+ }
+ if ((OBJ_obj2txt(buf, 3, obj, 1) != len)) {
+ fprintf(stderr, "FAIL: OBJ_obj2txt() with short buffer != %d\n",
+ len);
+ goto failed;
+ }
+
failed = 0;
failed: