mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 15:57:08 -05:00
added a check to make the code robust to structural errors in bd messages
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4048 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3be6ddb8df
commit
64b8f90120
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "bitdht/bencode.h"
|
#include "bitdht/bencode.h"
|
||||||
#include "bitdht/bdmsgs.h"
|
#include "bitdht/bdmsgs.h"
|
||||||
@ -646,6 +647,10 @@ int beMsgGetToken(be_node *n, bdToken &token)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int len = be_str_len(n);
|
int len = be_str_len(n);
|
||||||
|
|
||||||
|
if(len > BITDHT_TOKEN_MAX_LEN)
|
||||||
|
return 0 ;
|
||||||
|
|
||||||
for(int i = 0; i < len; i++)
|
for(int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
token.data[i] = n->val.s[i];
|
token.data[i] = n->val.s[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user