[Openvpn-devel,4/5] src/openvpn/ssl_verify.c: handle strdup errors

Message ID 20240708210912.566-5-chipitsine@gmail.com
State Changes Requested
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>
---
 src/openvpn/ssl_verify.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 934ff8d8..c4b95553 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -1629,6 +1629,10 @@  verify_user_pass(struct user_pass *up, struct tls_multi *multi,
         if (!multi->auth_token_initial)
         {
             multi->auth_token_initial = strdup(up->password);
+            if (!multi->auth_token_initial)
+            {
+                msg( M_FATAL, "Failed allocate memory for multi->auth_token_initial");
+            }
         }
 
         if (session->opt->auth_token_call_auth)
@@ -1749,6 +1753,10 @@  verify_user_pass(struct user_pass *up, struct tls_multi *multi,
                 && !(ks->auth_token_state_flags & AUTH_TOKEN_EXPIRED))
             {
                 multi->auth_token = strdup(up->password);
+                if (!multi->auth_token)
+                {
+                    msg( M_FATAL, "Failed allocate memory for multi->auth_token");
+                }
             }
 
             /*