aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Peter Korsgaard <peter@korsgaard.com>2018-01-10 23:03:03 +0100
committerGravatar Peter Korsgaard <peter@korsgaard.com>2018-01-16 19:45:05 +0100
commitc57572b95e9da33c1367e3706f4191147c9ad4c4 (patch)
treea4ff14010d6abcf04e0ffd98f9532224941cacca
parent2e18e017c53441c634e539463de9e11266913185 (diff)
downloadbuildroot-c57572b95e9da33c1367e3706f4191147c9ad4c4.tar.gz
buildroot-c57572b95e9da33c1367e3706f4191147c9ad4c4.tar.bz2
mcookie: correct wrong memset argument
Fixes #10216 Building mcookie generates a warning about possible wrong arguments to memset: mcookie.c:207:26: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ ctx is a pointer to a structure, so the code should use the size of the structure and not the size of the pointer when it tries to clear the structure, similar to how it got fixed upstream back in 2009: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/lib/md5.c?id=6596057175c6ed342dc20e85eae8a42eb29b629f Signed-off-by: Peter Korsgaard <peter@korsgaard.com> (cherry picked from commit 40f4191f2a1246b792ffc0c02b6c9bd2d62649f2) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
-rw-r--r--package/x11r7/mcookie/mcookie.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/package/x11r7/mcookie/mcookie.c b/package/x11r7/mcookie/mcookie.c
index 902d92fc47..3c38f6f3b3 100644
--- a/package/x11r7/mcookie/mcookie.c
+++ b/package/x11r7/mcookie/mcookie.c
@@ -204,7 +204,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */