From: Steffan Karger Date: Fri, 28 Jul 2017 10:38:22 +0000 (+0200) Subject: sample-plugins: fix ASN1_STRING_to_UTF8 return value checks X-Git-Tag: v2.5_beta1~615 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c43045ca0590364552fbd060cc65ee1c50a4866a;p=thirdparty%2Fopenvpn.git 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 Acked-by: David Sommerseth 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 --- diff --git a/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c b/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c index 44a8c027f..c4839077b 100644 --- a/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +++ b/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c @@ -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; } diff --git a/sample/sample-plugins/log/log_v3.c b/sample/sample-plugins/log/log_v3.c index 12da624c3..98d80d95a 100644 --- a/sample/sample-plugins/log/log_v3.c +++ b/sample/sample-plugins/log/log_v3.c @@ -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; }