Skip to content

Commit 5e26325

Browse files
committed
Merge branch 'security' into 'master'
Security Closes #10 See merge request !17
2 parents 1656dc1 + f67e766 commit 5e26325

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Diff for: src/core/misc.c

+3
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,9 @@ char *my_asctime(time_t t)
556556
int len;
557557

558558
tm = localtime(&t);
559+
if (tm == NULL)
560+
return g_strdup("???");
561+
559562
str = g_strdup(asctime(tm));
560563

561564
len = strlen(str);

Diff for: src/core/nicklist.c

+10-7
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,26 @@ static void nick_hash_add(CHANNEL_REC *channel, NICK_REC *nick)
5454

5555
static void nick_hash_remove(CHANNEL_REC *channel, NICK_REC *nick)
5656
{
57-
NICK_REC *list;
57+
NICK_REC *list, *newlist;
5858

5959
list = g_hash_table_lookup(channel->nicks, nick->nick);
6060
if (list == NULL)
6161
return;
6262

63-
if (list == nick || list->next == NULL) {
64-
g_hash_table_remove(channel->nicks, nick->nick);
65-
if (list->next != NULL) {
66-
g_hash_table_insert(channel->nicks, nick->next->nick,
67-
nick->next);
68-
}
63+
if (list == nick) {
64+
newlist = nick->next;
6965
} else {
66+
newlist = list;
7067
while (list->next != nick)
7168
list = list->next;
7269
list->next = nick->next;
7370
}
71+
72+
g_hash_table_remove(channel->nicks, nick->nick);
73+
if (newlist != NULL) {
74+
g_hash_table_insert(channel->nicks, newlist->nick,
75+
newlist);
76+
}
7477
}
7578

7679
/* Add new nick to list */

0 commit comments

Comments
 (0)