]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix session id in env missing first byte
authorArne Schwabe <arne@rfc2549.org>
Thu, 26 Mar 2020 17:23:31 +0000 (18:23 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 11 May 2020 18:58:50 +0000 (20:58 +0200)
sizeof for a constant string return the size including the null byte.
For copying the session id this meant that we do not copy the first
byte. This made the session id reported to the external authenticator
one byte shorter than it was intended to be.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200326172332.2356-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19622.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/auth_token.c

index d9212ee76b28508ac8730357ff7ddeed907217e1..cc70c06c3554f6791f37f2f26cdc01484babd931 100644 (file)
@@ -121,7 +121,7 @@ add_session_token_env(struct tls_session *session, struct tls_multi *multi,
      */
 
     char session_id[AUTH_TOKEN_SESSION_ID_LEN*2] = {0};
-    memcpy(session_id, session_id_source + sizeof(SESSION_ID_PREFIX),
+    memcpy(session_id, session_id_source + strlen(SESSION_ID_PREFIX),
            AUTH_TOKEN_SESSION_ID_LEN*8/6);
 
     setenv_str(session->opt->es, "session_id", session_id);