X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/6b200bc335dc93c5516ccb52f14bd896d8c7fad7..07691282a056c4efea71e1e505527601e8cc166b:/OSX/libsecurity_smime/lib/cmsdecode.c diff --git a/OSX/libsecurity_smime/lib/cmsdecode.c b/OSX/libsecurity_smime/lib/cmsdecode.c index 42107222..fdc69f3f 100644 --- a/OSX/libsecurity_smime/lib/cmsdecode.c +++ b/OSX/libsecurity_smime/lib/cmsdecode.c @@ -177,12 +177,15 @@ nss_cms_decoder_notify(void *arg, Boolean before, void *dest, int depth) if (nss_cms_before_data(p7dcx) != SECSuccess) { SEC_ASN1DecoderClearFilterProc(p7dcx->dcx); /* stop all processing */ p7dcx->error = PORT_GetError(); + PORT_SetError(0); // Clean the thread error since we've returned the error } } if (after && dest == &(cinfo->rawContent)) { /* we're right after of the data */ - if (nss_cms_after_data(p7dcx) != SECSuccess) + if (nss_cms_after_data(p7dcx) != SECSuccess) { p7dcx->error = PORT_GetError(); + PORT_SetError(0); // Clean the thread error since we've returned the error + } /* we don't need to see the contents anymore */ SEC_ASN1DecoderClearFilterProc(p7dcx->dcx); @@ -485,6 +488,7 @@ nss_cms_decoder_work_data(SecCmsDecoderRef p7dcx, data, len, final); if (rv != SECSuccess) { p7dcx->error = PORT_GetError(); + PORT_SetError(0); // Clean the thread error since we've returned the error goto loser; } @@ -600,6 +604,9 @@ SecCmsDecoderCreate(SecArenaPoolRef pool, SecCmsMessageRef cmsg; OSStatus result; + /* Clear the thread error to clean up dirty threads */ + PORT_SetError(0); + cmsg = SecCmsMessageCreate(pool); if (cmsg == NULL) goto loser; @@ -633,6 +640,7 @@ SecCmsDecoderCreate(SecArenaPoolRef pool, loser: result = PORT_GetError(); + PORT_SetError(0); // Clean the thread error since we've returned the error return result; } @@ -664,7 +672,7 @@ SecCmsDecoderUpdate(SecCmsDecoderRef p7dcx, const void *buf, CFIndex len) (void) SEC_ASN1DecoderFinish (p7dcx->dcx); p7dcx->dcx = NULL; } - PORT_SetError (p7dcx->error); + PORT_SetError (0); // Clean the thread error since we've returned the error return p7dcx->error; } @@ -719,6 +727,7 @@ loser: p7dcx->dcx = NULL; p7dcx->childp7dcx = NULL; PORT_Free(p7dcx); + PORT_SetError(0); // Clean the thread error since we've returned the error return result; }