From: Keir Fraser Subject: Re: [PATCH] Use string bounded functions Date: Mon, 29 Jan 2007 10:52:42 +0000 Message-ID: References: <200701291110.29420.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200701291110.29420.Christoph.Egger@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Christoph Egger , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 29/1/07 10:10, "Christoph Egger" wrote: > The attached patch replaces sprintf with snprintf and strncpy with strlcpy. > > There are various cases where no NULL-terminated strings are guaranteed > and eventual possible overflows. This patch fixes them. > > BTW: Since Xen kernel has its own string functions, can't we just remove > sprintf() and strncpy()? IMO, Xen should not inherit the historical C relicts. This makes plenty of sense. Strncpy() in particular is dangerous and strlcpy() is always preferable. So I'd be happy to see strncat/strncpy die. There are a few uses remaining (particularly in arch/ia64) that you'll have to fix first. And please add 'signed-off-by' attribution when you post patches! -- Keir