sample-plugins: fix ASN1_STRING_to_UTF8 return value checks

As we did in 2d032c7f for the ASN1_STRING_to_UTF8() calls in the core code,
we should also free(buf) if the function returns 0.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1501238302-16714-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15161.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
This commit is contained in:
Steffan Karger 2017-07-28 12:38:22 +02:00 committed by David Sommerseth
parent cd5a74d0d7
commit c43045ca05
No known key found for this signature in database
GPG key ID: 86CF944C9671FDF2
2 changed files with 2 additions and 2 deletions

View file

@ -143,7 +143,7 @@ session_user_set(struct session *sess, X509 *x509)
continue;
}
unsigned char *buf = NULL;
if (ASN1_STRING_to_UTF8(&buf, val) <= 0)
if (ASN1_STRING_to_UTF8(&buf, val) < 0)
{
continue;
}

View file

@ -227,7 +227,7 @@ x509_print_info(X509 *x509crt)
{
continue;
}
if (ASN1_STRING_to_UTF8(&buf, val) <= 0)
if (ASN1_STRING_to_UTF8(&buf, val) < 0)
{
continue;
}