mcookie: correct wrong memset argument
PATCH 1/1 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:
--- package/x11r7/mcookie/mcookie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/x11r7/mcookie/mcookie.c +1 -1
@@ -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 */
Signature · 1 line
2.11.0
PATCH 1/1 mcookie: correct wrong memset argument
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
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 */
Quoted 7 lines
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:
Signed-off-by Peter Korsgaard <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 mcookie: correct wrong memset argument
In reply to Peter KorsgaardQuoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
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 */
Quoted 7 lines
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:
Signed-off-by Peter Korsgaard <[email protected]>
Committed to 2017.11.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 mcookie: correct wrong memset argument
In reply to Peter KorsgaardQuoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
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 */
Quoted 7 lines
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:
Signed-off-by Peter Korsgaard <[email protected]>
Committed to 2017.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard