From: Selva Nair Date: Thu, 27 Oct 2022 16:06:19 +0000 (-0400) Subject: Do not copy auth_token username to itself X-Git-Tag: v2.6_beta1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbf142ffe597b21aa09a47677ea2061b74a9354e;p=thirdparty%2Fopenvpn.git Do not copy auth_token username to itself - Fixes a potential mis-behaviour (strncpy with dest == src) introduced by commits ecad4839c (2.6) and 3d792ae955 (2.5). Reported by: Gert Doering Signed-off-by: Selva Nair Acked-by: Gert Doering Message-Id: <20221027160619.11894-1-selva.nair@gmail.com> URL: https://www.mail-archive.com/search?l=mid&q=20221027160619.11894-1-selva.nair@gmail.com Signed-off-by: Gert Doering --- diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 3106c738a..24e8ba632 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2180,7 +2180,7 @@ key_method_2_write(struct buffer *buf, struct tls_multi *multi, struct tls_sessi goto error; } /* save username for auth-token which may get pushed later */ - if (session->opt->pull) + if (session->opt->pull && up != &auth_token) { strncpynt(auth_token.username, up->username, USER_PASS_LEN); }