about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-09-29 14:25:34 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-09-29 14:25:34 +0000
commit68fabbda6a718c42493592a42daf1fbeb23dbcd4 (patch)
treed09a517deebae39f3c14d0bd3a9e56ac54eef481
parent2f8aaaf5e425f2285e028e35a52d0766067ab3fd (diff)
downloadzsh-68fabbda6a718c42493592a42daf1fbeb23dbcd4.tar.gz
zsh-68fabbda6a718c42493592a42daf1fbeb23dbcd4.tar.xz
zsh-68fabbda6a718c42493592a42daf1fbeb23dbcd4.zip
Jun T.: 27292: fix length in socket call
-rw-r--r--ChangeLog7
-rw-r--r--Src/Modules/socket.c8
2 files changed, 8 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c9dc6211..533a3d7e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-29  Peter Stephenson  <pws@csr.com>
+
+	* Jun T.: 27292: Src/Modules/socket.c: abuse of UNIX_PATH_MAX on
+	Snow Leopard: use the correct maximum.
+
 2009-09-22  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* 27286: Src/Modules/socket.c Src/Modules/tcp.c Src/utils.c:
@@ -12215,5 +12220,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4787 $
+* $Revision: 1.4788 $
 *****************************************************
diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c
index ad7eb5884..6c70d3166 100644
--- a/Src/Modules/socket.c
+++ b/Src/Modules/socket.c
@@ -33,10 +33,6 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
-#ifndef UNIX_PATH_MAX
-# define UNIX_PATH_MAX 108
-#endif
-
 /*
  * We need to include the zsh headers later to avoid clashes with
  * the definitions on some systems, however we need the configuration
@@ -103,7 +99,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func))
 	}
 
 	soun.sun_family = AF_UNIX;
-	strncpy(soun.sun_path, localfn, UNIX_PATH_MAX);
+	strncpy(soun.sun_path, localfn, sizeof(soun.sun_path)-1);
 
 	if (bind(sfd, (struct sockaddr *)&soun, sizeof(struct sockaddr_un)))
 	{
@@ -232,7 +228,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func))
 	}
 
 	soun.sun_family = AF_UNIX;
-	strncpy(soun.sun_path, args[0], UNIX_PATH_MAX);
+	strncpy(soun.sun_path, args[0], sizeof(soun.sun_path)-1);
 	
 	if ((err = connect(sfd, (struct sockaddr *)&soun, sizeof(struct sockaddr_un)))) {
 	    zwarnnam(nam, "connection failed: %e", errno);