packages/opendkim/fix-RSA_Sign-call.patch

28 lines
849 B
Diff

Description: Fix signedness bug in RSA_Sign call
Author: Martin Grimm <martin.grimm@to.com>
Bug: https://github.com/trusteddomainproject/OpenDKIM/pull/159
--- a/libopendkim/dkim.c
+++ b/libopendkim/dkim.c
@@ -3951,6 +3951,7 @@
{
int nid;
struct dkim_crypto *crypto;
+ unsigned int ui_l = 0;
crypto = (struct dkim_crypto *) sig->sig_signature;
@@ -3961,9 +3962,11 @@
sig->sig_hashtype == DKIM_HASHTYPE_SHA256)
nid = NID_sha256;
+ /* use variable ui_l to savely get the length (unsigned int *) out of RSA_sign and into size_t type l */
status = RSA_sign(nid, digest, diglen,
- crypto->crypto_out, (int *) &l,
+ crypto->crypto_out, &ui_l,
crypto->crypto_key);
+ l = ui_l;
if (status != 1 || l == 0)
{
dkim_load_ssl_errors(dkim, 0);