hc
2024-08-14 d5ef2fdafdb09de9c2f876fc0edf2ba6bf224909
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
28
29
30
31
32
33
34
35
From 3a7997af72e7a4f70109d1639e6725b39046443e Mon Sep 17 00:00:00 2001
From: Francesco Giancane <30423178+fgiancane8@users.noreply.github.com>
Date: Fri, 2 Jul 2021 20:47:38 +0200
Subject: [PATCH] hmac.c: fix mismatching function prototype (#537)
 
The reported function raises a warning when compilers assert the flag
`-Warray-parameter=`, signaling that an array-type argument was promoted
to a pointer-type argument.
 
While in practice in most C implementations this is correct, fixing the
warning (and, in this case, indicating the maximum size for the array)
would represent a best-practice for finding out-of-bound accesses or
identifying wrongly-sized arrays passed in the function.
 
Signed-off-by: Francesco Giancane <francesco.giancane@accenture.com>
[Retrieved from:
https://github.com/Azure/azure-c-shared-utility/commit/3a7997af72e7a4f70109d1639e6725b39046443e]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 src/hmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/src/hmac.c b/src/hmac.c
index 53f2411f8..160af9d2f 100644
--- a/c-utility/src/hmac.c
+++ b/c-utility/src/hmac.c
@@ -208,7 +208,7 @@ int hmacFinalBits(HMACContext *ctx,
 *   sha Error Code.
 *
 */
-int hmacResult(HMACContext *ctx, uint8_t *digest)
+int hmacResult(HMACContext *ctx, uint8_t digest[USHAMaxHashSize])
 {
     if (!ctx) return shaNull;