Improve cryptit() fixes, suggested by caf.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@241 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-06-17 08:00:37 +00:00
parent df8328c3a1
commit b26e295137

View File

@@ -2823,11 +2823,11 @@ char *crypt();
char *BX_cryptit(const char *string) char *BX_cryptit(const char *string)
{ {
static char saltChars[] = static char saltChars[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ./"; "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./0123456789";
char *cpass = (char *)string; char *cpass = (char *)string;
char salt[3]; char salt[3];
salt[0] = saltChars[random_number(0) % sizeof(saltChars)]; salt[0] = saltChars[random_number(0) % (sizeof(saltChars) - 1)];
salt[1] = saltChars[random_number(0) % sizeof(saltChars)]; salt[1] = saltChars[random_number(0) % (sizeof(saltChars) - 1)];
salt[2] = 0; salt[2] = 0;
#if !defined(WINNT) #if !defined(WINNT)
cpass = crypt(string, salt); cpass = crypt(string, salt);