mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-13 00:53:14 -04:00
limited the number of packets to be parsed in a row, to prevent compressed data to contain an enormous number of packets. Fixes one possible attack pointed out by HM
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7013 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9eaea5de12
commit
2d64e3f540
1 changed files with 18 additions and 11 deletions
|
@ -3232,11 +3232,18 @@ int ops_parse(ops_parse_info_t *pinfo)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
unsigned long pktlen;
|
unsigned long pktlen;
|
||||||
|
int n_packets = 0 ;
|
||||||
|
|
||||||
do
|
do
|
||||||
// Parse until we get a return code of 0 (error) or -1 (EOF)
|
// Parse until we get a return code of 0 (error) or -1 (EOF)
|
||||||
{
|
{
|
||||||
r=ops_parse_one_packet(pinfo,&pktlen);
|
r=ops_parse_one_packet(pinfo,&pktlen);
|
||||||
|
|
||||||
|
if(++n_packets > 100)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"More than 100 packets parsed in a row. This is likely to be a buggy certificate.") ;
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
} while (r > 0);
|
} while (r > 0);
|
||||||
|
|
||||||
return pinfo->errors ? 0 : 1;
|
return pinfo->errors ? 0 : 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue