[Openvpn-devel,5/5] tests/unit_tests/openvpn/test_auth_token.c: handle strdup errors

Message ID 20240708210912.566-6-chipitsine@gmail.com
State Accepted
Headers show
Series handle strdup errors | expand

Commit Message

Илья Шипицин July 8, 2024, 9:08 p.m. UTC
Signed-off-by: Ilia Shipitsin <chipitsine@gmail.com>
---
 tests/unit_tests/openvpn/test_auth_token.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Frank Lichtenheld July 9, 2024, 12:31 p.m. UTC | #1
On Mon, Jul 08, 2024 at 11:08:22PM +0200, Ilia Shipitsin wrote:
> Signed-off-by: Ilia Shipitsin <chipitsine@gmail.com>
> ---
>  tests/unit_tests/openvpn/test_auth_token.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/unit_tests/openvpn/test_auth_token.c b/tests/unit_tests/openvpn/test_auth_token.c
> index 3a3cb69b..8a0c16af 100644
> --- a/tests/unit_tests/openvpn/test_auth_token.c
> +++ b/tests/unit_tests/openvpn/test_auth_token.c
> @@ -245,6 +245,7 @@ auth_token_test_known_keys(void **state)
>      now = 0;
>      /* Preload the session id so the same session id is used here */
>      ctx->multi.auth_token_initial = strdup(now0key0);
> +    assert_non_null(ctx->multi.auth_token_initial);
>  
>      /* Zero the hmac part to ensure we have a newly generated token */
>      zerohmac(ctx->multi.auth_token_initial);
> @@ -374,6 +375,7 @@ auth_token_test_random_keys(void **state)
>      now = 0x5c331e9c;
>      /* Preload the session id so the same session id is used here */
>      ctx->multi.auth_token_initial = strdup(random_token);
> +    assert_non_null(ctx->multi.auth_token_initial);
>  
>      free_key_ctx(&ctx->multi.opt.auth_token_key);
>      auth_token_init_secret(&ctx->multi.opt.auth_token_key, random_key, true);

Acked-by: Frank Lichtenheld <frank@lichtenheld.com>

Regards,
Gert Doering Sept. 9, 2024, 7:32 a.m. UTC | #2
Your patch has been applied to the master branch.

commit 611fa55ed1ef7e78e6015e77ace19aa4b2bf744e
Author: Ilia Shipitsin
Date:   Mon Jul 8 23:08:22 2024 +0200

     tests/unit_tests/openvpn/test_auth_token.c: handle strdup errors

     Signed-off-by: Ilia Shipitsin <chipitsine@gmail.com>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Message-Id: <20240708210912.566-6-chipitsine@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28882.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/unit_tests/openvpn/test_auth_token.c b/tests/unit_tests/openvpn/test_auth_token.c
index 3a3cb69b..8a0c16af 100644
--- a/tests/unit_tests/openvpn/test_auth_token.c
+++ b/tests/unit_tests/openvpn/test_auth_token.c
@@ -245,6 +245,7 @@  auth_token_test_known_keys(void **state)
     now = 0;
     /* Preload the session id so the same session id is used here */
     ctx->multi.auth_token_initial = strdup(now0key0);
+    assert_non_null(ctx->multi.auth_token_initial);
 
     /* Zero the hmac part to ensure we have a newly generated token */
     zerohmac(ctx->multi.auth_token_initial);
@@ -374,6 +375,7 @@  auth_token_test_random_keys(void **state)
     now = 0x5c331e9c;
     /* Preload the session id so the same session id is used here */
     ctx->multi.auth_token_initial = strdup(random_token);
+    assert_non_null(ctx->multi.auth_token_initial);
 
     free_key_ctx(&ctx->multi.opt.auth_token_key);
     auth_token_init_secret(&ctx->multi.opt.auth_token_key, random_key, true);