Skip to content

Commit

Permalink
test/v3nametest.c: Add check for OPENSSL_malloc
Browse files Browse the repository at this point in the history
As the potential failure of the OPENSSL_malloc(),
it should be better to add the check and return
error if fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #18573)

(cherry picked from commit b147b9d)
  • Loading branch information
JiangJias authored and paulidale committed Jun 22, 2022
1 parent 6408e7c commit 3cb3708
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/v3nametest.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ static int run_cert(X509 *crt, const char *nameincert,
char *name = OPENSSL_malloc(namelen + 1);
int match, ret;

if (!TEST_ptr(name))
return 0;
memcpy(name, *pname, namelen + 1);

match = -1;
Expand Down

0 comments on commit 3cb3708

Please sign in to comment.