Fix out-of-bounds error in cryptit() found by Coverity.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@240 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-06-16 14:40:52 +00:00
parent 88172a9004
commit df8328c3a1
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01]
* Fix out-of-bounds error in cryptit() found by Coverity. (flashback)
* Cleanup save_formats(). (caf)
* Fix off-by-one error in add_socketread() and set_socketwrite() found

View File

@@ -2826,8 +2826,8 @@ static char saltChars[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ./";
char *cpass = (char *)string;
char salt[3];
salt[0] = saltChars[random_number(0) % 64];
salt[1] = saltChars[random_number(0) % 64];
salt[0] = saltChars[random_number(0) % sizeof(saltChars)];
salt[1] = saltChars[random_number(0) % sizeof(saltChars)];
salt[2] = 0;
#if !defined(WINNT)
cpass = crypt(string, salt);