diff options
-rw-r--r-- | functions.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/functions.c b/functions.c index a8f0927..58be95f 100644 --- a/functions.c +++ b/functions.c @@ -1424,6 +1424,12 @@ int removenickfromallchannels(char *nickuserhost, struct channel *channels) { // Get the nick from the prefix extractnickfromprefix(nickuserhost); + // Make sure the nick has a length of at least one + if (strlen(nickuserhost) < 1) { + debugprint(DEBUG_CRIT, "updatenickinallchannels(): nick has no length, returning 0!\n"); + return 0; + } + // Go through all channels and remove nick if present for (int i = 0; i < MAXCHANNELS; i++) { // Go through all nicks in channel @@ -1451,6 +1457,12 @@ int updatenickinallchannels(char *nickuserhost, char *newnick, struct channel *c // Strip prefix from newnick stripprefix(newnick); + // Make sure the old and new nicks have a length of at least one + if (strlen(nickuserhost) < 1 || strlen(newnick) < 1) { + debugprint(DEBUG_CRIT, "updatenickinallchannels(): nick has no length, returning 0!\n"); + return 0; + } + // Go through all channels and update nick if present for (int i = 0; i < MAXCHANNELS; i++) { // Go through all nicks in channel |