From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3927 invoked from network); 29 Sep 2009 12:13:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 29 Sep 2009 12:13:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 71457 invoked from network); 29 Sep 2009 12:05:46 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Sep 2009 12:05:46 -0000 Received: (qmail 2194 invoked by alias); 29 Sep 2009 12:05:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27292 Received: (qmail 2184 invoked from network); 29 Sep 2009 12:05:42 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 29 Sep 2009 12:05:42 -0000 Received: from rcpt-expgw.biglobe.ne.jp (rcpt-expgw.biglobe.ne.jp [133.205.19.65]) by bifrost.dotsrc.org (Postfix) with ESMTP id 80B83808ECB9 for ; Tue, 29 Sep 2009 14:05:24 +0200 (CEST) Received: from vc-gw.biglobe.ne.jp by rcpt-expgw.biglobe.ne.jp (kbkr/0208160408) with SMTP id n8TC5LeU026459 for ; Tue, 29 Sep 2009 21:05:21 +0900 Received: from smtp-gw.biglobe.ne.jp ([172.21.175.156]) by vc-gw.biglobe.ne.jp (kbkr/0716090908) with ESMTP id n8TC5LZY018737 for ; Tue, 29 Sep 2009 21:05:21 +0900 X-Biglobe-Sender: Received: from [192.168.0.3] (125.196.138.35 [125.196.138.35]) by smtp-gw.biglobe.ne.jp id VAWKAC15AFDC; Tue, 29 Sep 2009 21:05:21 +0900 (JST) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Mime-Version: 1.0 (Apple Message framework v1076) Subject: Re: Rebuilding from CVS on Snow Leopard From: "Jun T." In-Reply-To: <090927225016.ZM17646@torch.brasslantern.com> Date: Tue, 29 Sep 2009 21:05:13 +0900 Content-Transfer-Encoding: 7bit Message-Id: References: <090927225016.ZM17646@torch.brasslantern.com> To: zsh-workers@sunsite.dk X-Mailer: Apple Mail (2.1076) X-Virus-Scanned: ClamAV 0.94.2/9849/Tue Sep 29 12:38:26 2009 on bifrost X-Virus-Status: Clean At 22:50 -0700 09/09/27, Bart Schaefer wrote: >gcc -c -I. -DHAVE_CONFIG_H -DMODULE -Wall -Wmissing-prototypes -O2 - fno-common -o socket..o socket.c >socket.c: In function 'bin_zsocket': >socket.c:106: warning: call to __builtin___strncpy_chk will always overflow destination buffer >socket.c:235: warning: call to __builtin___strncpy_chk will always overflow destination buffer MacOSX (and many BSD's as well?) does not define UNIX_PATH_MAX, and struct sockaddr_un is defined in sys/un.h as struct sockaddr_un { unsigned char sun_len; /* sockaddr len including null */ sa_family_t sun_family; /* [XSI] AF_UNIX */ char sun_path[104]; /* [XSI] path name (gag) */ }; so we can't define UNIX_PATH_MAX to 108. I think it would be better to use sizeof(soun.sun_path) in place of UNIX_PATH_MAX. Or use sizeof(soun.sun_path)-1 so that sun_path is always null terminated. Index: Src/Modules/socket.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/socket.c,v retrieving revision 1.13 diff -u -r1.13 socket.c --- Src/Modules/socket.c 22 Sep 2009 16:04:15 -0000 1.13 +++ Src/Modules/socket.c 29 Sep 2009 10:11:35 -0000 @@ -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 @@ } 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 @@ } 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);