Skip to content

Commit

Permalink
[XrdCrypto] Fix potential memory related issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jan 17, 2018
1 parent 7699ef5 commit 055c0ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/XrdCrypto/XrdCryptoX509Chain.cc
Expand Up @@ -586,7 +586,7 @@ int XrdCryptoX509Chain::Reorder()
}

// Move it in first position if not yet there
if (nr != begin) {
if (nr && nr != begin) {
np->SetNext(nr->Next()); // short cut old position
nr->SetNext(begin); // set our next to present begin
if (end == nr) // Update end
Expand Down
4 changes: 2 additions & 2 deletions src/XrdCrypto/XrdCryptosslRSA.cc
Expand Up @@ -361,7 +361,7 @@ int XrdCryptosslRSA::GetPublen()
return publen;
}
//_____________________________________________________________________________
int XrdCryptosslRSA::ExportPublic(char *out, int)
int XrdCryptosslRSA::ExportPublic(char *&out, int)
{
// Export the public key into buffer out. The length of the buffer should be
// at least GetPublen()+1 bytes. If out=0 the buffer is m-allocated internally
Expand Down Expand Up @@ -426,7 +426,7 @@ int XrdCryptosslRSA::GetPrilen()
}

//_____________________________________________________________________________
int XrdCryptosslRSA::ExportPrivate(char *out, int)
int XrdCryptosslRSA::ExportPrivate(char *&out, int)
{
// Export the private key into buffer out. The length of the buffer should be
// at least GetPrilen()+1 bytes. If out=0 the buffer is m-allocated internally
Expand Down
4 changes: 2 additions & 2 deletions src/XrdCrypto/XrdCryptosslRSA.hh
Expand Up @@ -70,9 +70,9 @@ public:

// Import / Export methods
int ImportPublic(const char *in, int lin);
int ExportPublic(char *out, int lout);
int ExportPublic(char *&out, int lout);
int ImportPrivate(const char *in, int lin);
int ExportPrivate(char *out, int lout);
int ExportPrivate(char *&out, int lout);

// Encryption / Decryption methods
int EncryptPrivate(const char *in, int lin, char *out, int lout);
Expand Down

0 comments on commit 055c0ca

Please sign in to comment.