Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge branch 'security' into 'master'
Security

Closes #10

See merge request !17
  • Loading branch information
ailin-nemui committed Jul 5, 2017
2 parents 1656dc1 + f67e766 commit 5e26325
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/core/misc.c
Expand Up @@ -556,6 +556,9 @@ char *my_asctime(time_t t)
int len;

tm = localtime(&t);
if (tm == NULL)
return g_strdup("???");

str = g_strdup(asctime(tm));

len = strlen(str);
Expand Down
17 changes: 10 additions & 7 deletions src/core/nicklist.c
Expand Up @@ -54,23 +54,26 @@ static void nick_hash_add(CHANNEL_REC *channel, NICK_REC *nick)

static void nick_hash_remove(CHANNEL_REC *channel, NICK_REC *nick)
{
NICK_REC *list;
NICK_REC *list, *newlist;

list = g_hash_table_lookup(channel->nicks, nick->nick);
if (list == NULL)
return;

if (list == nick || list->next == NULL) {
g_hash_table_remove(channel->nicks, nick->nick);
if (list->next != NULL) {
g_hash_table_insert(channel->nicks, nick->next->nick,
nick->next);
}
if (list == nick) {
newlist = nick->next;
} else {
newlist = list;
while (list->next != nick)
list = list->next;
list->next = nick->next;
}

g_hash_table_remove(channel->nicks, nick->nick);
if (newlist != NULL) {
g_hash_table_insert(channel->nicks, newlist->nick,
newlist);
}
}

/* Add new nick to list */
Expand Down

0 comments on commit 5e26325

Please sign in to comment.