mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-09 14:52:28 -04:00
Fixed crash and memory leak in parse_literal_data.
Added "break" in RsInit::InitRetroShare. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5225 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bc9fa8ff3e
commit
af19809ef7
2 changed files with 14 additions and 12 deletions
|
@ -671,8 +671,9 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||||
{
|
{
|
||||||
std::cerr << " * Preferred * " << std::endl;
|
std::cerr << " * Preferred * " << std::endl;
|
||||||
userId = it->sslId;
|
userId = it->sslId;
|
||||||
userName = it->pgpName;
|
userName = it->pgpName;
|
||||||
existingUser = true;
|
existingUser = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!existingUser)
|
if (!existingUser)
|
||||||
|
|
|
@ -2107,21 +2107,22 @@ static int parse_literal_data(ops_region_t *region,ops_parse_info_t *pinfo)
|
||||||
|
|
||||||
while(region->length_read < region->length)
|
while(region->length_read < region->length)
|
||||||
{
|
{
|
||||||
unsigned l=region->length-region->length_read;
|
unsigned l=region->length-region->length_read;
|
||||||
|
|
||||||
if(C.literal_data_body.data != NULL)
|
C.literal_data_body.data = (unsigned char *)malloc(l) ;
|
||||||
free(C.literal_data_body.data) ;
|
|
||||||
|
|
||||||
C.literal_data_body.data = (unsigned char *)malloc(l) ;
|
if(!limited_read(C.literal_data_body.data,l,region,pinfo))
|
||||||
|
{
|
||||||
|
free(C.literal_data_body.data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(!limited_read(C.literal_data_body.data,l,region,pinfo))
|
C.literal_data_body.length=l;
|
||||||
return 0;
|
|
||||||
|
|
||||||
C.literal_data_body.length=l;
|
ops_parse_hash_data(pinfo,C.literal_data_body.data,l);
|
||||||
|
|
||||||
ops_parse_hash_data(pinfo,C.literal_data_body.data,l);
|
CBP(pinfo,OPS_PTAG_CT_LITERAL_DATA_BODY,&content);
|
||||||
|
free(C.literal_data_body.data);
|
||||||
CBP(pinfo,OPS_PTAG_CT_LITERAL_DATA_BODY,&content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue