From f061557aad3c30cd6bc7bfc89306c472dec5e0d3 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Thu, 18 Oct 2018 21:20:27 +0200 Subject: [PATCH] Protocol.c: fix crash with OpenVPN when the certificate's common name is empty --- src/Cedar/Protocol.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Cedar/Protocol.c b/src/Cedar/Protocol.c index b5e8ed79..c73acdbb 100644 --- a/src/Cedar/Protocol.c +++ b/src/Cedar/Protocol.c @@ -7094,8 +7094,7 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x) { return NULL; } - wcstombs(cn_username, x->subject_name->CommonName, 127); - cn_username[127] = '\0'; + UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName); PackAddStr(p, "username", cn_username); } else