mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
fixed possible malloc error when the size is absurdly big (potentially caused by a deliberate attack)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7002 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
53b5f8222e
commit
3a567b2d6f
1 changed files with 6 additions and 0 deletions
|
@ -2211,6 +2211,12 @@ static int parse_literal_data(ops_region_t *region,ops_parse_info_t *pinfo)
|
|||
|
||||
C.literal_data_body.data = (unsigned char *)malloc(l) ;
|
||||
|
||||
if(C.literal_data_body.data == NULL)
|
||||
{
|
||||
fprintf(stderr,"parse_literal_data(): cannot malloc for requested size %d.\n",l) ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
if(!limited_read(C.literal_data_body.data,l,region,pinfo))
|
||||
{
|
||||
free(C.literal_data_body.data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue