From: jsing Date: Sun, 20 Feb 2022 13:47:53 +0000 (+0000) Subject: Test OBJ_obj2txt() with NULL and short buffers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bf20c6a4492127375a7dbd519b682144d8c3b136;p=openbsd Test OBJ_obj2txt() with NULL and short buffers. --- 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: