Skip to content

Commit

Permalink
(fix) added safety checks in S/MIME (fixes #4745)
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed May 23, 2019
1 parent 0bb2443 commit 29f5357
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -25,6 +25,7 @@ Bug fixes
- [core] avoid generating broken DTSTART for the freebusy.ifb file (#4289)
- [core] consider DAVx5 like Apple Calendar (#4304)
- [core] improve handling of signer certificate (#4742)
- [core] added safety checks in S/MIME (#4745)

4.0.7 (2019-02-27)
------------------
Expand Down
12 changes: 5 additions & 7 deletions SoObjects/Mailer/NSData+SMIME.m
Expand Up @@ -47,7 +47,7 @@ @implementation NSData (SOGoMailSMIME)
//
- (NSData *) signUsingCertificateAndKey: (NSData *) theData
{
NSData *output;
NSData *output = NULL;

BIO *tbio = NULL, *sbio = NULL, *obio = NULL;
X509 *scert = NULL;
Expand All @@ -65,7 +65,6 @@ - (NSData *) signUsingCertificateAndKey: (NSData *) theData

OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
output = nil;

bytes = [theData bytes];
len = [theData length];
Expand Down Expand Up @@ -128,7 +127,7 @@ - (NSData *) signUsingCertificateAndKey: (NSData *) theData
//
- (NSData *) encryptUsingCertificate: (NSData *) theData
{
NSData *output;
NSData *output = NULL;

BUF_MEM *bptr = NULL;
BIO *tbio = NULL, *sbio = NULL, *obio = NULL;
Expand Down Expand Up @@ -215,7 +214,7 @@ - (NSData *) encryptUsingCertificate: (NSData *) theData
//
- (NSData *) decryptUsingCertificate: (NSData *) theData
{
NSData *output;
NSData *output = NULL;

BIO *tbio, *sbio, *obio;
BUF_MEM *bptr;
Expand Down Expand Up @@ -311,7 +310,7 @@ - (NGMimeMessage *) messageFromEncryptedDataAndCertificate: (NSData *) theCertif
//
- (NSData *) convertPKCS12ToPEMUsingPassword: (NSString *) thePassword
{
NSData *output;
NSData *output = NULL;

BIO *ibio, *obio;
EVP_PKEY *pkey;
Expand All @@ -326,7 +325,6 @@ - (NSData *) convertPKCS12ToPEMUsingPassword: (NSString *) thePassword

OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
output = nil;

bytes = [self bytes];
len = [self length];
Expand Down Expand Up @@ -383,7 +381,7 @@ - (NSData *) convertPKCS12ToPEMUsingPassword: (NSString *) thePassword
//
- (NSData *) signersFromPKCS7
{
NSData *output;
NSData *output = NULL;

STACK_OF(X509) *certs = NULL;
BIO *ibio, *obio;
Expand Down

0 comments on commit 29f5357

Please sign in to comment.