]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
sample-plugins: fix ASN1_STRING_to_UTF8 return value checks
authorSteffan Karger <steffan.karger@fox-it.com>
Fri, 28 Jul 2017 10:38:22 +0000 (12:38 +0200)
committerDavid Sommerseth <davids@openvpn.net>
Mon, 14 Aug 2017 13:10:52 +0000 (15:10 +0200)
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>
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c
sample/sample-plugins/log/log_v3.c

index 44a8c027f602f83ec72d83abda47e32c8f920c58..c4839077b26195894cb759ae1ccd4b53cebd8e3f 100644 (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;
         }
index 12da624c3925e4b0d324387d7ef5c7e37c9a8cc6..98d80d95aa864f43df9e14577f777517ecd42276 100644 (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;
         }