From 1ee02bdfb5951ae94b423af911db789a0a9dc7ce Mon Sep 17 00:00:00 2001 From: "rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Thu, 23 Feb 2006 07:29:59 +0000 Subject: [PATCH] Applied Trystans patch for bug: 448 git-svn-id: svn://svn.anope.org/anope/trunk@970 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@695 5417fbe8-f217-4b02-8779-1006273d7864 --- Changes | 1 + src/users.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 9ceb4e40b..7da224c26 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,7 @@ Provided by illu. - 2006 01/25 F Updated the french language file. [ #00] Provided by Trystan - 2006 +02/23 F Usermatching possible null arg on sstrdup. [ #00] 02/12 F Double unbanning of in certain conditions. [ #00] 01/25 F va_copy issue for various platforms. [ #00] diff --git a/src/users.c b/src/users.c index d62fba853..c8abab7c3 100644 --- a/src/users.c +++ b/src/users.c @@ -977,10 +977,16 @@ int is_excepted_mask(ChannelInfo * ci, char *mask) int match_usermask(const char *mask, User * user) { - char *mask2 = sstrdup(mask); + char *mask2; char *nick, *username, *host; int result; + if (!mask || !*mask) { + return 0; + } + + mask2 = sstrdup(mask); + if (strchr(mask2, '!')) { nick = strtok(mask2, "!"); username = strtok(NULL, "@"); @@ -1016,10 +1022,16 @@ int match_usermask(const char *mask, User * user) int match_userip(const char *mask, User * user, char *iphost) { - char *mask2 = sstrdup(mask); + char *mask2; char *nick, *username, *host; int result; + if (!mask || !*mask) { + return 0; + } + + mask2 = sstrdup(mask); + if (strchr(mask2, '!')) { nick = strtok(mask2, "!"); username = strtok(NULL, "@");