Commit 7ca2121d authored by Niels Möller's avatar Niels Möller
Browse files

* src/client_x11.c (make_client_x11_display): Free the fake cookie

if we fail.
(make_forward_x11): Make up a random cookie.

Rev: src/client_x11.c:1.5
parent ee073cd9
......@@ -48,6 +48,8 @@
#define X11_WINDOW_SIZE 10000
#define X11_COOKIE_LENGTH 16
/* GABA:
(class
(name client_x11_auth_info)
......@@ -514,6 +516,7 @@ make_client_x11_display(const char *display, struct lsh_string *fake)
if (!self->address)
{
werror("Can't parse X11 display: `%s'\n", display);
lsh_string_free(fake);
KILL(self);
return NULL;
}
......@@ -637,10 +640,16 @@ do_format_request_x11_forward(struct channel_request_command *s,
/* Consumes fake */
struct command *
make_forward_x11(const char *display_string, struct lsh_string *fake)
make_forward_x11(const char *display_string,
struct randomness *random)
{
struct client_x11_display *display
= make_client_x11_display(display_string, fake);
struct lsh_string *fake = lsh_string_alloc(X11_COOKIE_LENGTH);
struct client_x11_display *display;
RANDOM(random, fake->length, fake->data);
/* This deallocates fake if it fails. */
display = make_client_x11_display(display_string, fake);
if (display)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment