Jump to content
Eternal Lands Official Forums
Sign in to follow this  
ttlanhil

assert in pm_log.c

Recommended Posts

when running in a client compiled -DDEBUG, sometimes (usually after I go AFK) the client will hit a wanring and wait for input, this freezes the client. it turns out that it comes back to pm_log.c. in particular, my_namecmp(char *check)

 

when calling isalpha(), sometimes the char sent is outside allowable bounds

the following trivial patch stops the assert from firing, but I wonder if there are other problems related to this

Index: pm_log.c
===================================================================
RCS file: /cvsroot/elc/elc/pm_log.c,v
retrieving revision 1.25
diff -u -r1.25 pm_log.c
--- pm_log.c	27 Oct 2005 18:38:32 -0000	1.25
+++ pm_log.c	2 Nov 2005 14:40:17 -0000
@@ -156,7 +156,7 @@
	my_tolower(username);

	for(;i<20 && username[i] && check[i]==username[i];i++);
-	if(check[i]==username[i]||((check[i]==' '||!isalpha(check[i])) && !username[i])) return 0;
+	if(check[i]==username[i]||((check[i]==' '||!isalpha((unsigned char)check[i])) && !username[i])){return 0;}
	return 1;
}

(should we be using a signed char pointer when calling this function?)

oh yes, and it seems to be a problem with shorter nicks, and the comparison will continue past the name, and get to a colour code

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×