nasmlib: md5c -- Use size of struct ctx for memset

fixes pvs-studio 'V512 A call of the 'memset' function will lead to
underflow of the buffer 'ctx'.'

Signed-off-by: Martin Lindhe <martin-commit@ubique.se>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Martin Lindhe 2016-11-16 15:56:42 +01:00 committed by Cyrill Gorcunov
parent 3478078c5f
commit 058782948d

View File

@ -143,7 +143,7 @@ void MD5Final(unsigned char digest[16], MD5_CTX *ctx)
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */
memset((char *) ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */