[PATCH] Adjust memset() call in mysys/md5.c
Art Haas <[email protected]>
| Newsgroups | gmane.comp.db.mysql.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi. I tried out 'clang' to build MySQL, and a warning about the memset() call on line 179 showed up with a suggested correction of dereferencing 'ctx' in the sizeof() call. A look at the code and I think that the 'clang' compiler suggestion is valid as the memset() call is only adjusting a pointer-sized number of bytes in the 'ctx' structure instead of clearing the entire thing, plus the change makes the code match the intention of the comment. My build was the 'mysql-trunk', but a quick look at the 'mysql-5.5' branch and few of the 'mysql-server/cluster' branches shows the patch could also be applied there as well. Art Haas === modified file 'mysys/md5.c' --- mysys/md5.c 2009-03-09 18:57:03 +0000 +++ mysys/md5.c 2011-07-17 12:54:31 +0000 @@ -176,7 +176,7 @@ putu32(ctx->buf[1], digest + 4); putu32(ctx->buf[2], digest + 8); putu32(ctx->buf[3], digest + 12); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 -- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/[email protected]