From 9eedcacfcbdb56a5b3cd044a01bac47707381e2f Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 20 Feb 2022 13:47:54 +0000 Subject: Test OBJ_obj2txt() with NULL and short buffers. --- regress/lib/libcrypto/objects/objectstest.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 * @@ -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: -- cgit v1.2.3