Browse Source

TT#14008 fix rand_hex_string usage

rand_hex_string() writes a terminated null byte, therefore the buffer
must be larger by one byte.

Change-Id: Ieca67754d67fd7e5f1c94b07ffc8d0de428f552a
rfuchs/1283
Richard Fuchs 5 years ago
parent
commit
faee34f1a0
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      daemon/control_ng.c

+ 3
- 3
daemon/control_ng.c View File

@ -589,10 +589,10 @@ fail:
static void notify_tcp_client(gpointer key, gpointer value, gpointer user_data) {
struct streambuf_stream *s = (struct streambuf_stream *)value;
str *to_send = (str *)user_data;
char cookie_buf[16];
str cookie = STR_CONST_INIT_LEN(cookie_buf, sizeof(cookie_buf));
char cookie_buf[17];
str cookie = STR_CONST_INIT(cookie_buf);
rand_hex_str(cookie_buf, sizeof(cookie_buf) / 2);
rand_hex_str(cookie_buf, cookie.len / 2);
control_ng_send(&cookie, to_send, &s->sock.remote, &s->sock);
}


Loading…
Cancel
Save