diff process-packet.c @ 27:08da099e8337

- Rename common-packet.c to packet.c - buf_burn the unencrypted read/write payload buffers after use to avoid sensitive contents sitting in memory for too long
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Jul 2004 02:14:42 +0000
parents 0969767bca0d
children e2a1eaa19f22
line wrap: on
line diff
--- a/process-packet.c	Mon Jul 26 02:44:20 2004 +0000
+++ b/process-packet.c	Tue Jul 27 02:14:42 2004 +0000
@@ -116,7 +116,7 @@
 	 * less-than-or-equal-to 60 ( == MAX_UNAUTH_PACKET_TYPE ).
 	 * NOTE: if the protocol changes and new types are added, revisit this 
 	 * assumption */
-	if ( !ses.authdone && type > MAX_UNAUTH_PACKET_TYPE ) {
+	if ( !ses.authstate.authdone && type > MAX_UNAUTH_PACKET_TYPE ) {
 		dropbear_exit("received message %d before userauth", type);
 	}
 
@@ -138,6 +138,7 @@
 	recv_unimplemented();
 
 out:
+	buf_burn(ses.payload); /* Clear the memory to avoid swapping it out */
 	buf_free(ses.payload);
 	ses.payload = NULL;