From 68fabbda6a718c42493592a42daf1fbeb23dbcd4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 29 Sep 2009 14:25:34 +0000 Subject: Jun T.: 27292: fix length in socket call --- Src/Modules/socket.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Src/Modules') 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 #include -#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); -- cgit 1.4.1