[ipxe-devel] [PATCH 2/2] [tls] Fix wrong memset in function tls_clear_cipher

Stefan Weil sw at weilnetz.de
Wed Apr 4 16:16:01 UTC 2012


sizeof(cipherspec) is obviously wrong in this context,
because it will only zero the first 4 or 8 bytes
(cipherspec is a pointer).

This problem was reported by cppcheck.

Signed-off-by: Stefan Weil <sw at weilnetz.de>
---
 src/net/tls.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/net/tls.c b/src/net/tls.c
index ce39da9..0f11fbe 100644
--- a/src/net/tls.c
+++ b/src/net/tls.c
@@ -594,7 +594,7 @@ static void tls_clear_cipher ( struct tls_session *tls __unused,
 			       cipherspec->pubkey_ctx );
 	}
 	free ( cipherspec->dynamic );
-	memset ( cipherspec, 0, sizeof ( cipherspec ) );
+	memset ( cipherspec, 0, sizeof ( *cipherspec ) );
 	cipherspec->suite = &tls_cipher_suite_null;
 }
 
-- 
1.7.9




More information about the ipxe-devel mailing list