Update of /cvsroot/netrek/client/cow
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16466

Modified Files:
	cowmain.c feature.c socket.c ChangeLog 
Log Message:
fix some valgrind use of uninitialised data reports

Index: feature.c
===================================================================
RCS file: /cvsroot/netrek/client/cow/feature.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- feature.c	11 Jun 1999 16:14:17 -0000	1.3
+++ feature.c	20 May 2006 08:48:16 -0000	1.4
@@ -14,6 +14,9 @@
  * feature packets look like:
  *
  * $Log$
+ * Revision 1.4  2006/05/20 08:48:16  quozl
+ * fix some valgrind use of uninitialised data reports
+ *
  * Revision 1.3  1999/06/11 16:14:17  siegl
  * cambot replay patches
  *
@@ -273,6 +276,7 @@
 {
   struct feature_cpacket packet;
 
+  bzero(&packet, sizeof(packet));
   STRNCPY(packet.name, name, sizeof(packet.name));
   packet.type = CP_FEATURE;
   packet.name[sizeof(packet.name) - 1] = 0;

Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/cow/cowmain.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cowmain.c	22 Jun 2002 10:37:20 -0000	1.13
+++ cowmain.c	20 May 2006 08:48:16 -0000	1.14
@@ -2,6 +2,9 @@
 /* main.c
  *
  * $Log$
+ * Revision 1.14  2006/05/20 08:48:16  quozl
+ * fix some valgrind use of uninitialised data reports
+ *
  * Revision 1.13  2002/06/22 10:37:20  siegl
  * Release 3.01
  *
@@ -119,6 +122,7 @@
 
 #include <stdio.h>
 #include INC_STRINGS
+#include <unistd.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <pwd.h>

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/cow/socket.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- socket.c	16 May 2006 06:25:25 -0000	1.9
+++ socket.c	20 May 2006 08:48:16 -0000	1.10
@@ -8,6 +8,9 @@
  * Routines to allow connection to the xtrek server.
  *
  * $Log$
+ * Revision 1.10  2006/05/20 08:48:16  quozl
+ * fix some valgrind use of uninitialised data reports
+ *
  * Revision 1.9  2006/05/16 06:25:25  quozl
  * some compilation fixes
  *
@@ -1959,6 +1962,7 @@
 {
   struct login_cpacket packet;
 
+  bzero(&packet, sizeof(packet));
   strcpy(packet.name, name);
   strcpy(packet.password, pass);
   if (strlen(login) > 15)
@@ -2251,6 +2255,7 @@
 {
   struct options_cpacket optPacket;
 
+  bzero(&optPacket, sizeof(optPacket));
   optPacket.type = CP_OPTIONS;
   optPacket.flags =
       htonl(ST_MAPMODE +			 /* always on */
@@ -2280,6 +2285,7 @@
       else
           newsocket = (newsocket + 10687) & 32767;
     }
+  bzero(&sockPack,sizeof(sockPack));
   sockPack.type = CP_SOCKET;
   sockPack.socket = htonl(newsocket);
   sockPack.version = (char) SOCKVERSION;

Index: ChangeLog
===================================================================
RCS file: /cvsroot/netrek/client/cow/ChangeLog,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ChangeLog	20 May 2006 08:12:54 -0000	1.30
+++ ChangeLog	20 May 2006 08:48:16 -0000	1.31
@@ -1,3 +1,10 @@
+Sat May 20 18:48:13 2006  James Cameron  <quozl at us.netrek.org>
+
+	* cowmain.c, feature.c, socket.c: fix some valgrind reports of use
+	of uninitialised data, possible sources of random information
+	leakage in packets sent to server in situations where auto (stack)
+	variables for packets may not be initialised.
+
 Sat May 20 18:10:01 2006  James Cameron  <quozl at us.netrek.org>
 
 	* mkcflags.c (main): compilation fixes for -Wall.