*** empty log message ***
authorroot <root>
Wed, 9 Aug 2006 22:01:07 +0000 (22:01 +0000)
committerroot <root>
Wed, 9 Aug 2006 22:01:07 +0000 (22:01 +0000)
Changes
src/rxvtc.C
src/rxvtd.C

diff --git a/Changes b/Changes
index e8b3afa1401d59400af020585f576a62bbe58c89..f055aec2b4ffc80dad8f3f8ab62755a1f0e298d4 100644 (file)
--- a/Changes
+++ b/Changes
@@ -21,7 +21,9 @@ WISH: http://www120.pair.com/mccarthy/nextstep/intro.htmld/Workspace.html is the
 WISH: kick out xpm.C, replace by pixbuf
 DUMB: support tex fonts
 
-TODO: fix crash because strwidth returning -1 in selection-popup
+TODO: fix crash because strwidth returning -1 in selection-popup in LC_ALL=C
+       - give proper diagnostic when RXVT_SOCKET is too long instead of
+          corrupting the stack (patch by exg).
 
 7.9  Mon Aug  7 18:16:07 CEST 2006
         - fix the crashing bug people encountered with 7.8 + urxvtd + perl
index 951f0537aa107bcc38d892333b6c82d660cb7de2..f424f313216eb7909fd31720881ccc8cc9d2d197 100644 (file)
@@ -1,4 +1,4 @@
-/*--------------------------------*-C-*---------------------------------*
+/*----------------------------------------------------------------------*
  * File:       rxvtc.C
  *----------------------------------------------------------------------*
  *
@@ -45,14 +45,21 @@ struct client : rxvt_connection {
 
 client::client ()
 {
+  sockaddr_un sa;
+  char *sockname = rxvt_connection::unix_sockname ();
+  
+  if (strlen(sockname) >= sizeof(sa.sun_path))
+    {
+      fputs ("socket name too long, aborting.\n", stderr);
+      exit (STATUS_FAILURE);
+    }
+  
   if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
     {
       perror ("unable to create communications socket");
       exit (STATUS_FAILURE);
     }
 
-  char *sockname = rxvt_connection::unix_sockname ();
-  sockaddr_un sa;
   sa.sun_family = AF_UNIX;
   strcpy (sa.sun_path, sockname);
   free (sockname);
index 98a6e83aa5d60042a8c25e50e607cba7b0cb812a..f4b39a5a11d33fc6ae67128f180c1ae57c8eb3ff 100644 (file)
@@ -1,4 +1,4 @@
-/*--------------------------------*-C-*---------------------------------*
+/*----------------------------------------------------------------------*
  * File:       rxvtd.C
  *----------------------------------------------------------------------*
  *
@@ -71,6 +71,11 @@ struct unix_listener {
 unix_listener::unix_listener (const char *sockname)
 : accept_ev (this, &unix_listener::accept_cb)
 {
+  sockaddr_un sa;
+  
+  if (strlen(sockname) >= sizeof(sa.sun_path))
+    rxvt_fatal ("socket name too long, aborting.\n");
+
   if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
     {
       perror ("unable to create listening socket");
@@ -79,8 +84,6 @@ unix_listener::unix_listener (const char *sockname)
 
   fcntl (fd, F_SETFD, FD_CLOEXEC);
 
-  sockaddr_un sa;
-
   sa.sun_family = AF_UNIX;
   strcpy (sa.sun_path, sockname);