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
This commit is contained in:
Kevin Easton
2013-03-01 12:33:00 +00:00
parent 17e3a91f03
commit 73269ea887
2 changed files with 27 additions and 25 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01] [Changes 1.2c01]
* Fix crash after /SETAR -, reported by riderplus. (caf)
* Remove special handling of 484 numeric, which is no longer needed and * Remove special handling of 484 numeric, which is no longer needed and
was buggy (making BitchX think that usermode +G was set). (caf) was buggy (making BitchX think that usermode +G was set). (caf)

View File

@@ -134,37 +134,37 @@ void fake (void)
int check_auto_reply(char *str) int check_auto_reply(char *str)
{ {
char *p = NULL; char *p = NULL;
char *pat; char *pat;
if (!str || !*str || !get_int_var(AUTO_RESPONSE_VAR))
if (!str || !*str || !get_int_var(AUTO_RESPONSE_VAR) || !auto_str)
return 0; return 0;
p = LOCAL_COPY(auto_str); 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))
case 3: goto found_auto;
if (!my_stricmp(str, pat)) continue;
goto found_auto; case 2:
continue; if (wild_match(pat, str))
case 2: goto found_auto;
if (wild_match(pat, str)) continue;
goto found_auto; case 1:
continue; if (stristr(str, pat))
case 1: goto found_auto;
if (stristr(str, pat)) continue;
goto found_auto; default:
continue; case 0:
default: if (!my_strnicmp(str, pat, strlen(pat)))
case 0: goto found_auto;
if (!my_strnicmp(str, pat, strlen(pat))) continue;
goto found_auto;
continue;
}
} }
} }
return 0; return 0;
found_auto: found_auto:
#ifdef GUI #ifdef GUI