Parcourir la source

MD5: Fix clearing of temporary stack memory to use correct length

sizeof of the structure instead of the pointer was supposed to be used
here. Fix this to clear the full structure at the end of MD5Final().
Jouni Malinen il y a 14 ans
Parent
commit
40eebf2353
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/crypto/md5-internal.c

+ 1 - 1
src/crypto/md5-internal.c

@@ -188,7 +188,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
     MD5Transform(ctx->buf, (u32 *) ctx->in);
     byteReverse((unsigned char *) ctx->buf, 4);
     os_memcpy(digest, ctx->buf, 16);
-    os_memset(ctx, 0, sizeof(ctx));	/* In case it's sensitive */
+    os_memset(ctx, 0, sizeof(*ctx));	/* In case it's sensitive */
 }
 
 /* The four core functions - F1 is optimized somewhat */