Merge pull request #51 from tantongchao/master

修复3des解密函数decrypt3内去除填充字符时,清除位置越界引发异常
This commit is contained in:
ruanshudong 2020-03-28 14:09:29 +08:00 committed by GitHub
commit 030eb7ad8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -560,7 +560,10 @@ string TC_Des::decrypt3(const char *key, const char * sIn, size_t iInlen)
{
//去掉填充字符
int pad = (int)(*(ret.end() - 1));
ret.erase(ret.end() - pad, ret.end());
if (pad<0 || pad>ret.length())
ret.clear();
else
ret.erase(ret.end() - pad, ret.end());
}
delete []in_data;