aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2011-04-24 00:59:28 +0000
committerDavid Sommerseth <dazo@users.sourceforge.net>2011-04-26 22:29:12 +0200
commitd5497262ae1d1a7cf50a45b5ab6750f63bf8565d (patch)
tree8e3f6e8a5f51808cf4b6067ff2bddffc7a454562 /buffer.c
parentRevert r7092 and r7151, i.e. remove --enable-osxipconfig (diff)
downloadopenvpn-d5497262ae1d1a7cf50a45b5ab6750f63bf8565d.tar.xz
Added 'dir' flag to "crl-verify" (see man page for info).
Don't call SSL_CTX_set_client_CA_list or SSL_CTX_set_client_CA_list if not running in server mode (these functions are only useful for TLS/SSL servers). Modified openvpn_snprintf to return false on overflow, and true otherwise. When AUTH_FAILED,... is received, log the full string. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@7213 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/buffer.c b/buffer.c
index 2952767..5499d99 100644
--- a/buffer.c
+++ b/buffer.c
@@ -218,20 +218,21 @@ buf_printf (struct buffer *buf, const char *format, ...)
/*
* This is necessary due to certain buggy implementations of snprintf,
* that don't guarantee null termination for size > 0.
+ * Return false on overflow.
*/
-int openvpn_snprintf(char *str, size_t size, const char *format, ...)
+bool openvpn_snprintf(char *str, size_t size, const char *format, ...)
{
va_list arglist;
- int ret = 0;
+ int len = -1;
if (size > 0)
{
va_start (arglist, format);
- ret = vsnprintf (str, size, format, arglist);
+ len = vsnprintf (str, size, format, arglist);
va_end (arglist);
str[size - 1] = 0;
}
- return ret;
+ return (len >= 0 && len < size);
}
/*