]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Warn user if INFO control command is too long
authorLev Stipakov <lev@openvpn.net>
Fri, 22 Sep 2023 10:50:55 +0000 (12:50 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 22 Sep 2023 12:01:46 +0000 (14:01 +0200)
"INFO_PRE,..." command length is limited to 256 bytes. If the server
implementation pushes command which is too long, warn the user and
don't send the truncated command to a management client.

Change-Id: If3c27a2a2ba24f2af0e3e3c95eea57ed420b2542
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20230922105055.37969-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27062.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/push.c

index 5f5755ab44bface3f1d590410bb876039d96c441..224943406cb9f45959dec1c28a5465c7cd35a143 100644 (file)
@@ -242,8 +242,14 @@ server_pushed_info(struct context *c, const struct buffer *buffer,
          * for management greeting and we don't want to confuse the client
          */
         struct buffer out = alloc_buf_gc(256, &gc);
-        buf_printf(&out, ">%s:%s", "INFOMSG", m);
-        management_notify_generic(management, BSTR(&out));
+        if (buf_printf(&out, ">%s:%s", "INFOMSG", m))
+        {
+            management_notify_generic(management, BSTR(&out));
+        }
+        else
+        {
+            msg(D_PUSH_ERRORS, "WARNING: Received INFO command is too long, won't notify management client.");
+        }
 
         gc_free(&gc);
     }