changeset 1766:6cbb9360e8e2 trunk

[svn] - always zero-out stack variables, as stack memory may be dirty on x86 and friends
author nenolod
date Mon, 02 Oct 2006 01:46:59 -0700
parents c186ee9524ed
children ea802d0c9ac4
files ChangeLog audacious/controlsocket.c libaudacious/beepctrl.c
diffstat 3 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 01 00:58:32 2006 -0700
+++ b/ChangeLog	Mon Oct 02 01:46:59 2006 -0700
@@ -1,3 +1,11 @@
+2006-10-01 07:58:32 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [2467]
+  - enforce the ret = -1 == silent failure rule
+  
+  trunk/audacious/input.c |    2 ++
+  1 file changed, 2 insertions(+)
+
+
 2006-09-30 23:05:40 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2465]
   - Spanish translation update from Gustavo Vranjes.
--- a/audacious/controlsocket.c	Sun Oct 01 00:58:32 2006 -0700
+++ b/audacious/controlsocket.c	Mon Oct 02 01:46:59 2006 -0700
@@ -255,6 +255,8 @@
 {
     ServerPktHeader pkthdr;
 
+    memset(&pkthdr, '\0', sizeof(ServerPktHeader));
+
     pkthdr.version = XMMS_PROTOCOL_VERSION;
     pkthdr.data_length = length;
     if ((size_t)write(fd, &pkthdr, sizeof(ServerPktHeader)) < sizeof(pkthdr))
--- a/libaudacious/beepctrl.c	Sun Oct 01 00:58:32 2006 -0700
+++ b/libaudacious/beepctrl.c	Mon Oct 02 01:46:59 2006 -0700
@@ -61,6 +61,8 @@
 {
     gpointer data = NULL;
 
+    memset(pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if (read(fd, pkt_hdr, sizeof(ServerPktHeader)) ==
         sizeof(ServerPktHeader)) {
         if (pkt_hdr->data_length) {
@@ -81,6 +83,8 @@
     gpointer data;
     ServerPktHeader pkt_hdr;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     data = remote_read_packet(fd, &pkt_hdr);
     if (data)
         g_free(data);
@@ -93,6 +97,8 @@
 {
     ClientPktHeader pkt_hdr;
 
+    memset(&pkt_hdr, '\0', sizeof(ClientPktHeader));
+
     pkt_hdr.version = XMMS_PROTOCOL_VERSION;
     pkt_hdr.command = command;
     pkt_hdr.data_length = data_length;
@@ -172,6 +178,8 @@
     gpointer data;
     gint fd;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, cmd, NULL, 0);
@@ -193,6 +201,8 @@
     gpointer data;
     gint fd, ret = 0;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, cmd, NULL, 0);
@@ -214,6 +224,8 @@
     gint fd;
     gfloat ret = 0.0;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, cmd, NULL, 0);
@@ -234,6 +246,8 @@
     gpointer data;
     gint fd;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return NULL;
     remote_send_packet(fd, cmd, NULL, 0);
@@ -250,6 +264,8 @@
     gpointer data;
     gint fd;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return NULL;
     remote_send_packet(fd, cmd, &pos, sizeof(guint32));
@@ -606,6 +622,8 @@
     gint fd;
     gpointer data;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return;
 
@@ -737,6 +755,8 @@
     gint fd, ret = 0;
     guint32 p = pos;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, CMD_GET_PLAYLIST_TIME, &p, sizeof(guint32));
@@ -757,6 +777,8 @@
     gint fd;
     gpointer data;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return;
     remote_send_packet(fd, CMD_GET_INFO, NULL, 0);
@@ -964,6 +986,8 @@
     gint fd, ret = 0;
     guint32 p = pos;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, CMD_PLAYQUEUE_IS_QUEUED, &p, sizeof(guint32));
@@ -985,6 +1009,8 @@
     gint fd, ret = 0;
     guint32 p = pos;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, CMD_PLAYQUEUE_GET_POS, &p, sizeof(guint32));
@@ -1006,6 +1032,8 @@
     gint fd, ret = 0;
     guint32 p = pos;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return ret;
     remote_send_packet(fd, CMD_PLAYQUEUE_GET_QPOS, &p, sizeof(guint32));
@@ -1026,6 +1054,8 @@
     gint fd;
     gpointer data;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if (preamp)
         *preamp = 0.0;
 
@@ -1065,6 +1095,8 @@
     gpointer data;
     gfloat val = 0.0;
 
+    memset(&pkt_hdr, '\0', sizeof(ServerPktHeader));
+
     if ((fd = xmms_connect_to_session(session)) == -1)
         return val;
     remote_send_packet(fd, CMD_GET_EQ_BAND, &band, sizeof(band));