mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
Merge pull request #51 from tantongchao/master
修复3des解密函数decrypt3内去除填充字符时,清除位置越界引发异常
This commit is contained in:
commit
030eb7ad8f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user