Commit: 6543547691ed11810ea50ea685f6431b98c7f6d7
Parent: a754ebdc1a6a7905d80c4b1ad234958c8b376670
Author: opask
Date: Fri, 31 Aug 2018 17:27:31 -0600
https.c: remove extra strlen call, add missing includes
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/https.c b/https.c
@@ -18,6 +18,8 @@
*/
#include <openssl/ssl.h>
+#include <openssl/x509v3.h>
+#include <string.h>
#include "links.h"
@@ -37,8 +39,9 @@ static struct list_head session_cache = { &session_cache, &session_cache };
static int ssl_password_callback(char *buf, int size, int rwflag, void *userdata)
{
- if (size > strlen((char *)ssl_options.client_cert_password))
- size = strlen((char *)ssl_options.client_cert_password);
+ const size_t sl = strlen((char *)ssl_options.client_cert_password);
+ if (size > sl)
+ size = sl;
memcpy(buf, ssl_options.client_cert_password, size);
return size;
}