Commit ad523511 authored by rswindell's avatar rswindell

Clean-up guruchat(), iirc, this fixes a potential crash.

parent 5181347c
......@@ -1543,12 +1543,14 @@ void sbbs_t::guruchat(char* line, char* gurubuf, int gurunum, char* last_answer)
j=strlen(line);
k=0;
for(i=0;i<j;i++) {
if(!isalnum(line[i]) && !k) /* beginning non-alphanumeric */
continue;
if(!isalnum(line[i]) && line[i]==line[i+1]) /* redundant non-alnum */
continue;
if(!isalnum(line[i]) && line[i+1]=='?') /* fix "WHAT ?" */
continue;
if(line[i]<0 || !isalnum(line[i])) {
if(!k) /* beginning non-alphanumeric */
continue;
if(line[i]==line[i+1]) /* redundant non-alnum */
continue;
if(line[i+1]=='?') /* fix "WHAT ?" */
continue;
}
cstr[k++]=line[i];
}
cstr[k]=0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment