EnergyMech

Forum | Features | Download | Addons | Help | #emech | Links | About | Contact

Versions | News Archive | Installing | Linking | Configuration | Commands | FAQ


The time is now Saturday, September 23rd, 2017, 4:33pm

Create account ]   User/Pass   


Forum Index :: EnergyMech 3.x Development :: emech-3.0.99p3 crashes on users with empty passwords :: Reply to this topic

Author
 
kroseneg
Posted :: 2:39pm, Sat, Jun 19, 2010     Subject :: emech-3.0.99p3 crashes on users with empty passwords


Posts: 12
 
    Hi

v3.0.99p3 crashes in the function Strlen2() when loading the userfile when there are users with empty password. The following patch fixes this crash.

cu Korbi


--- function.c.orig 2010-05-20 08:51:15.000000000 +0200
+++ function.c 2010-06-19 16:28:13.000000000 +0200
@@ -202,11 +202,11 @@
__attr(CORE_SEG,__regparm(2))
int Strlen2(const char *one, const char *two)
{
- const char *s1,*s2;
-
- for(s1=one;*s1;s1++);
- for(s2=two;*s2;s2++);
- return((s1 - one) + (s2 - two));
+ int a = 0;
+ int b = 0;
+ if (one) a = strlen(one);
+ if (two) b = strlen(two);
+ return (a + b);
}

__attr(CORE_SEG,__regparm(2))


 
proton
Posted :: 10:34am, Sun, Jun 20, 2010


Posts: 165
 
    Strlen2() is one of the functions where null checking responsibility is upon the caller, not the function

 

Copyright © 2000-2005 Proton,  All rights reserved. Last edited August 16th, 2005.
HTML 4.01 CSS