From 73269ea88759befdf1fa01df390c190e0f5ae16c Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Fri, 1 Mar 2013 12:33:00 +0000 Subject: [PATCH] Bail out of check_auto_reply() early if auto_str is NULL. This fixes a crash after /SETAR -. Reported by riderplus. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@234 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 2 ++ source/parse.c | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Changelog b/Changelog index dbd1fac..50676d0 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Fix crash after /SETAR -, reported by riderplus. (caf) + * Remove special handling of 484 numeric, which is no longer needed and was buggy (making BitchX think that usermode +G was set). (caf) diff --git a/source/parse.c b/source/parse.c index 7d07cb6..68d95cd 100644 --- a/source/parse.c +++ b/source/parse.c @@ -134,37 +134,37 @@ void fake (void) int check_auto_reply(char *str) { -char *p = NULL; -char *pat; - if (!str || !*str || !get_int_var(AUTO_RESPONSE_VAR)) + char *p = NULL; + char *pat; + + if (!str || !*str || !get_int_var(AUTO_RESPONSE_VAR) || !auto_str) return 0; + p = LOCAL_COPY(auto_str); - if (p && *p) + while ((pat = next_arg(p, &p))) { - while ((pat = next_arg(p, &p))) + switch(get_int_var(NICK_COMPLETION_TYPE_VAR)) { - switch(get_int_var(NICK_COMPLETION_TYPE_VAR)) - { - case 3: - if (!my_stricmp(str, pat)) - goto found_auto; - continue; - case 2: - if (wild_match(pat, str)) - goto found_auto; - continue; - case 1: - if (stristr(str, pat)) - goto found_auto; - continue; - default: - case 0: - if (!my_strnicmp(str, pat, strlen(pat))) - goto found_auto; - continue; - } + case 3: + if (!my_stricmp(str, pat)) + goto found_auto; + continue; + case 2: + if (wild_match(pat, str)) + goto found_auto; + continue; + case 1: + if (stristr(str, pat)) + goto found_auto; + continue; + default: + case 0: + if (!my_strnicmp(str, pat, strlen(pat))) + goto found_auto; + continue; } } + return 0; found_auto: #ifdef GUI