[isomd5sum] Fix for gcc type-punned and sizeof pointer warnings.
Brian C. Lane
bcl at redhat.com
Thu Feb 21 23:11:01 UTC 2013
From: "Brian C. Lane" <bcl at redhat.com>
Casting the unsigned char array to uint32 generates this warning when
building with gcc 4.8.0
---
md5.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/md5.c b/md5.c
index 111aa86..ca6bf50 100644
--- a/md5.c
+++ b/md5.c
@@ -151,13 +151,12 @@ void MD5_Final(unsigned char digest[16], struct MD5Context *ctx)
if (ctx->doByteReverse) byteReverse(ctx->in, 14);
/* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
+ memcpy(ctx->in+56, ctx->bits, sizeof(ctx->bits));
MD5_Transform(ctx->buf, (uint32 *) ctx->in);
if (ctx->doByteReverse) 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 */
}
#ifndef ASM_MD5
--
1.8.1.2
More information about the anaconda-patches
mailing list