From owner-freebsd-bugs Fri Oct 26 8:34:44 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 3097E37B405 for ; Fri, 26 Oct 2001 08:34:42 -0700 (PDT) Received: from localhost (arr@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f9QFYMC88367; Fri, 26 Oct 2001 11:34:22 -0400 (EDT) (envelope-from arr@watson.org) Date: Fri, 26 Oct 2001 11:34:21 -0400 (EDT) From: "Andrew R. Reiter" To: Garrett Wollman Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/31507: Risk of buffer overflow in struct sockaddr_un In-Reply-To: <200110261520.f9QFK1e07958@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 26 Oct 2001, Garrett Wollman wrote: : No, the correct code would ALWAYS be: : : strncpy(server.sun_path, file_fifo, sizeof server.sun_path); Does this handle off-by-one situations? Also, in terms of using strncpy, would it be more wise to utilize strlcpy() rather than a strncpy()/buf[sizeof(buf)-1] = 0; throughout the tree? Or has strlcpy() had some negative feedback? Cheers, Andrew *-------------................................................. | Andrew R. Reiter | arr@fledge.watson.org | "It requires a very unusual mind | to undertake the analysis of the obvious" -- A.N. Whitehead To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message