summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-02-23 07:29:59 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-02-23 07:29:59 +0000
commit1ee02bdfb5951ae94b423af911db789a0a9dc7ce (patch)
treebaefd012f290dfda4fdd9e57fb5cb2a6b3e27e0e
parent755f87ec420fb8886e79de9000d1ca39149e475c (diff)
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
-rw-r--r--Changes1
-rw-r--r--src/users.c16
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. <illu@rs2i.net> - 2006
01/25 F Updated the french language file. [ #00]
Provided by Trystan <trystan@nomadirc.net> - 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, "@");