Strengthen the algorithm that generates a random cookie for /detach.
This is a backwards-compatible change, no update to the scr-bx binary is necessary. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@358 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -2559,13 +2559,16 @@ void kill_attached_if_needed(int type)
|
||||
|
||||
void make_cookie(void)
|
||||
{
|
||||
int i, j;
|
||||
memset(connect_cookie, 0, sizeof(connect_cookie));
|
||||
for (i = 0; i < (int) (20.0 * rand()/RAND_MAX) + 5; i++)
|
||||
{
|
||||
j = (int)(95.0 * rand()/RAND_MAX);
|
||||
connect_cookie[i] = j + 32;
|
||||
}
|
||||
unsigned char rand_bytes[21];
|
||||
int i;
|
||||
char *cookie;
|
||||
|
||||
for (i = 0; i < sizeof rand_bytes; i++)
|
||||
rand_bytes[i] = random_number(0);
|
||||
|
||||
cookie = base64_encode(rand_bytes, sizeof rand_bytes);
|
||||
strlcpy(connect_cookie, cookie, sizeof connect_cookie);
|
||||
new_free(&cookie);
|
||||
}
|
||||
|
||||
static int create_ipc_socket(void)
|
||||
|
||||
Reference in New Issue
Block a user