repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 4693226d6983b5ed4bd74b32a8daa9a3124ed17c:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 4693226d6983b5ed4bd74b32a8daa9a3124ed17c
Author: Alexander Barton 
Date:   Mon Jan 4 20:37:13 2016 +0100

    Get rid of unclever assert() in Send_Message_Mask()

    Either we use assert() to _guarantee_ a certain condition, or we use
    if(...) to test for it. But never both.

    So get rid of the assert() in Send_Message_Mask() and handle the case
    that the target mask doesn't contain a dot (".") as regular error,
    don't require the caller to assure that any more.

    This polishes commit 5a312824.

    Please note:
    The test in Send_Message() is still _required_ to detect whether the
    target is a channel (no dot) or a "target mask" (at least one dot)!

diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index ad8c0506905eca3fdaf5787914be740b7a4b9e21..
index ..e990cfd7a0397d2f6e42c9e42dc7d4d10db2a8af 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -744,10 +744,7 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
 	 * dot (".") and no wildcards ("*", "?") following the last one.
 	 */
 	check_wildcards = strrchr(targetMask, '.');
-	assert(check_wildcards != NULL);
-	if (check_wildcards &&
-		check_wildcards[strcspn(check_wildcards, "*?")])
-	{
+	if (!check_wildcards || check_wildcards[strcspn(check_wildcards, "*?")]) {
 		if (!SendErrors)
 			return true;
 		return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL, targetMask);

-----END OF PAGE-----