File: fix-RSA_Sign-call.patch

package info (click to toggle)
opendkim 2.11.0~beta2-8%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,012 kB
  • sloc: ansic: 67,183; perl: 3,322; sh: 1,354; makefile: 1,046; php: 153; python: 115; xml: 39; csh: 18; cs: 1
file content (27 lines) | stat: -rw-r--r-- 849 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);