Skip to content

Commit

Permalink
Warn user if INFO control command is too long
Browse files Browse the repository at this point in the history
"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 <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg27062.html
Signed-off-by: Gert Doering <[email protected]>
(cherry picked from commit df624fb)
  • Loading branch information
lstipakov authored and cron2 committed Sep 22, 2023
1 parent 70ef43f commit 785b501
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/openvpn/push.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,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);
}
Expand Down

0 comments on commit 785b501

Please sign in to comment.