diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-09-29 14:25:34 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-09-29 14:25:34 +0000 |
commit | 68fabbda6a718c42493592a42daf1fbeb23dbcd4 (patch) | |
tree | d09a517deebae39f3c14d0bd3a9e56ac54eef481 /Src | |
parent | 2f8aaaf5e425f2285e028e35a52d0766067ab3fd (diff) | |
download | zsh-68fabbda6a718c42493592a42daf1fbeb23dbcd4.tar.gz zsh-68fabbda6a718c42493592a42daf1fbeb23dbcd4.tar.xz zsh-68fabbda6a718c42493592a42daf1fbeb23dbcd4.zip |
Jun T.: 27292: fix length in socket call
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Modules/socket.c | 8 |
1 files changed, 2 insertions, 6 deletions
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); |